[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>
|
---|
[5202] | 17 | var map;
|
---|
| 18 | var markers;
|
---|
| 19 | var icon;
|
---|
| 20 | var fromProjection;
|
---|
| 21 | var toProjection;
|
---|
| 22 |
|
---|
[5201] | 23 | function initialize(lat, lon) {
|
---|
| 24 | map = new OpenLayers.Map("basicMap",
|
---|
| 25 | {controls:[
|
---|
| 26 | new OpenLayers.Control.Navigation(),
|
---|
| 27 | new OpenLayers.Control.PanZoomBar()]});
|
---|
[5202] | 28 | fromProjection = new OpenLayers.Projection("EPSG:4326"); // WGS 1984
|
---|
| 29 | toProjection = new OpenLayers.Projection("EPSG:900913"); // Spherical Mercator
|
---|
[5201] | 30 |
|
---|
[5202] | 31 | var mapnik = new OpenLayers.Layer.OSM();
|
---|
| 32 | var position = new OpenLayers.LonLat(lon, lat).transform(fromProjection, toProjection);
|
---|
| 33 | var zoom = 15;
|
---|
[5201] | 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 |
|
---|
[5202] | 40 | icon = new OpenLayers.Icon('crosshair.png', size, offset);
|
---|
| 41 | markers = new OpenLayers.Layer.Markers("Markers");
|
---|
| 42 |
|
---|
[5201] | 43 | markers.addMarker(new OpenLayers.Marker(position, icon));
|
---|
| 44 |
|
---|
| 45 | map.addLayer(markers);
|
---|
| 46 |
|
---|
| 47 | map.setCenter(position, zoom);
|
---|
| 48 | }
|
---|
[5202] | 49 |
|
---|
| 50 | function gotoLocation(lat, lon) {
|
---|
| 51 | var position = new OpenLayers.LonLat(lon, lat).transform(fromProjection, toProjection);
|
---|
| 52 | map.setCenter(position);
|
---|
| 53 | }
|
---|
| 54 |
|
---|
[5201] | 55 | </script>
|
---|
| 56 |
|
---|
| 57 | </head>
|
---|
| 58 |
|
---|
| 59 | <body onload="initialize(50.090956, 8.663283);">
|
---|
| 60 | <div id="basicMap"></div>
|
---|
| 61 | </body>
|
---|
| 62 |
|
---|
| 63 | </html>
|
---|