- Timestamp:
- Jun 17, 2013, 10:35:40 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/map/map_osm.html
r5212 r5247 21 21 var fromProjection; 22 22 var toProjection; 23 var useTrace; 24 var zoom; 23 25 24 function initialize(lat, lon) { 26 function initialize(lat, lon, trace) { 27 useTrace = trace; 28 25 29 map = new OpenLayers.Map("basicMap", 26 30 {controls:[ … … 29 33 fromProjection = new OpenLayers.Projection("EPSG:4326"); // WGS 1984 30 34 toProjection = new OpenLayers.Projection("EPSG:900913"); // Spherical Mercator 35 zoom = 0; 31 36 32 37 var mapnik = new OpenLayers.Layer.OSM(); 33 38 var position = new OpenLayers.LonLat(lon, lat).transform(fromProjection, toProjection); 34 var zoom = 15;35 39 36 40 map.addLayer(mapnik); … … 46 50 map.addLayer(markers); 47 51 48 map.setCenter(position, zoom);52 map.setCenter(position, 3); 49 53 } 50 54 51 55 function gotoLocation(lat, lon) { 52 56 var position = new OpenLayers.LonLat(lon, lat).transform(fromProjection, toProjection); 53 map.setCenter(position); 57 if (zoom == 0) { 58 zoom = 15; 59 map.setCenter(position, zoom); 60 } 61 else { 62 map.setCenter(position); 63 } 54 64 markers.removeMarker(marker); 55 65 marker = new OpenLayers.Marker(position, icon);
Note:
See TracChangeset
for help on using the changeset viewer.