var map; var vectorLayer; var nodes_json = "nodes.json" OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control); function init() { map = new OpenLayers.Map ("map", { controls:[ new OpenLayers.Control.Navigation(), new OpenLayers.Control.PanZoomBar(), new OpenLayers.Control.Attribution(), new OpenLayers.Control.ScaleLine(), new OpenLayers.Control.MousePosition()], maxResolution: 156543.0399, numZoomLevels: 19, units: 'm', projection: new OpenLayers.Projection("EPSG:900913"), displayProjection: new OpenLayers.Projection("EPSG:4326") } ); arrayOSM = ["http://otile1.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.jpg", "http://otile2.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.jpg", "http://otile3.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.jpg", "http://otile4.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.jpg"]; var layerMapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik", {opacity: 0.5}); var baseOSM = new OpenLayers.Layer.OSM("MapQuest-OSM Tiles", arrayOSM); map.addLayer(baseOSM); var center = new OpenLayers.LonLat(10.13846, 54.32260).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()); var zoom = 13 map.setCenter(center, zoom); vectorLayer = new OpenLayers.Layer.Vector("Nodes"); map.addLayer(vectorLayer); selectControl = new OpenLayers.Control.SelectFeature(map.layers[1], {onSelect: onFeatureSelect, onUnselect: onFeatureUnselect}); map.addControl(selectControl); selectControl.activate(); var click = new OpenLayers.Control.Click(); map.addControl(click); click.activate(); load_json(vectorLayer, map) } function resizeMap() { if (map !== undefined) { map.updateSize() // Did someone say Chrome bug? map.removeLayer(vectorLayer) map.addLayer(vectorLayer) } } function onPopupClose(evt) { selectControl.unselect(selectedFeature); } function onFeatureSelect(feature) { selectedFeature = feature; popup = new OpenLayers.Popup.FramedCloud("chicken", feature.geometry.getBounds().getCenterLonLat(), new OpenLayers.Size(100,150), "