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

Last change on this file since 5201 was 5201, checked in by mervart, 11 years ago
File size: 1.5 KB
RevLine 
[5201]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 function initialize(lat, lon) {
18 map = new OpenLayers.Map("basicMap",
19 {controls:[
20 new OpenLayers.Control.Navigation(),
21 new OpenLayers.Control.PanZoomBar()]});
22
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;
28
29 map.addLayer(mapnik);
30
31 var markers = new OpenLayers.Layer.Markers("Markers");
32 var size = new OpenLayers.Size(40,40);
33 var offset = new OpenLayers.Pixel(-size.w/2, -size.h/2);
34 var icon = new OpenLayers.Icon('../html/crosshair.png', size, offset);
35
36 markers.addMarker(new OpenLayers.Marker(position, icon));
37
38 map.addLayer(markers);
39
40 map.setCenter(position, zoom);
41 }
42 </script>
43
44 </head>
45
46 <body onload="initialize(50.090956, 8.663283);">
47 <div id="basicMap"></div>
48 </body>
49
50</html>
Note: See TracBrowser for help on using the repository browser.