- Timestamp:
- Jun 10, 2013, 4:10:45 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/map/html/index_osm.html
r5201 r5202 15 15 16 16 <script> 17 var map; 18 var markers; 19 var icon; 20 var fromProjection; 21 var toProjection; 22 17 23 function initialize(lat, lon) { 18 24 map = new OpenLayers.Map("basicMap", … … 20 26 new OpenLayers.Control.Navigation(), 21 27 new OpenLayers.Control.PanZoomBar()]}); 28 fromProjection = new OpenLayers.Projection("EPSG:4326"); // WGS 1984 29 toProjection = new OpenLayers.Projection("EPSG:900913"); // Spherical Mercator 22 30 23 var mapnik = new OpenLayers.Layer.OSM(); 24 var fromProjection = new OpenLayers.Projection("EPSG:4326"); // WGS 1984 25 var toProjection = new OpenLayers.Projection("EPSG:900913"); // Spherical Mercator 26 var position = new OpenLayers.LonLat(lon, lat).transform(fromProjection, toProjection); 27 var zoom = 15; 31 var mapnik = new OpenLayers.Layer.OSM(); 32 var position = new OpenLayers.LonLat(lon, lat).transform(fromProjection, toProjection); 33 var zoom = 15; 28 34 29 35 map.addLayer(mapnik); 30 36 31 var markers = new OpenLayers.Layer.Markers("Markers");32 37 var size = new OpenLayers.Size(40,40); 33 38 var offset = new OpenLayers.Pixel(-size.w/2, -size.h/2); 34 var icon = new OpenLayers.Icon('../html/crosshair.png', size, offset); 39 40 icon = new OpenLayers.Icon('crosshair.png', size, offset); 41 markers = new OpenLayers.Layer.Markers("Markers"); 35 42 36 43 markers.addMarker(new OpenLayers.Marker(position, icon)); … … 40 47 map.setCenter(position, zoom); 41 48 } 49 50 function gotoLocation(lat, lon) { 51 var position = new OpenLayers.LonLat(lon, lat).transform(fromProjection, toProjection); 52 map.setCenter(position); 53 } 54 42 55 </script> 43 56
Note:
See TracChangeset
for help on using the changeset viewer.