source: ntrip/trunk/BNC/src/map/html/index_osm.html@ 5204

Last change on this file since 5204 was 5204, checked in by mervart, 9 years ago
File size: 1.7 KB
Line 
1<!DOCTYPE HTML>
2<html>
3
4 <head>
5 <title>BNC OpenStreetMap View</title>
6 <style type="text/css">
7 html, body, #basicMap {
8 width: 100%;
9 height: 100%;
10 margin: 0;
11 }
12 </style>
13
14 <script src="http://openlayers.org/api/OpenLayers.js" ></script>
15
16 <script>
17 var map;
18 var markers;
19 var icon;
20 var fromProjection;
21 var toProjection;
22
23 function initialize(lat, lon) {
24 map = new OpenLayers.Map("basicMap",
25 {controls:[
26 new OpenLayers.Control.Navigation(),
27 new OpenLayers.Control.PanZoomBar()]});
28 fromProjection = new OpenLayers.Projection("EPSG:4326"); // WGS 1984
29 toProjection = new OpenLayers.Projection("EPSG:900913"); // Spherical Mercator
30
31 var mapnik = new OpenLayers.Layer.OSM();
32 var position = new OpenLayers.LonLat(lon, lat).transform(fromProjection, toProjection);
33 var zoom = 15;
34
35 map.addLayer(mapnik);
36
37 var size = new OpenLayers.Size(40,40);
38 var offset = new OpenLayers.Pixel(-size.w/2, -size.h/2);
39
40 icon = new OpenLayers.Icon("qrc:///map/html/crosshair.png", size, offset);
41 markers = new OpenLayers.Layer.Markers("Markers");
42
43 markers.addMarker(new OpenLayers.Marker(position, icon));
44
45 map.addLayer(markers);
46
47 map.setCenter(position, zoom);
48 }
49
50 function gotoLocation(lat, lon) {
51 var position = new OpenLayers.LonLat(lon, lat).transform(fromProjection, toProjection);
52 map.setCenter(position);
53 }
54
55 </script>
56
57 </head>
58
59 <body>
60 <div id="basicMap"></div>
61 </body>
62
63</html>
Note: See TracBrowser for help on using the repository browser.