| Rev | Line | |
|---|
| [5183] | 1 | <!DOCTYPE HTML>
|
|---|
| 2 | <html>
|
|---|
| [5194] | 3 |
|
|---|
| [5183] | 4 | <head>
|
|---|
| [5194] | 5 | <title>BNC OpenStreetMap View</title>
|
|---|
| [5183] | 6 | <style type="text/css">
|
|---|
| 7 | html, body, #basicMap {
|
|---|
| 8 | width: 100%;
|
|---|
| 9 | height: 100%;
|
|---|
| 10 | margin: 0;
|
|---|
| 11 | }
|
|---|
| 12 | </style>
|
|---|
| [5194] | 13 |
|
|---|
| [5193] | 14 | <script src="http://openlayers.org/api/OpenLayers.js" ></script>
|
|---|
| [5194] | 15 |
|
|---|
| [5183] | 16 | <script>
|
|---|
| [5194] | 17 | function initialize(lat, lon) {
|
|---|
| [5197] | 18 | map = new OpenLayers.Map("basicMap",
|
|---|
| 19 | {controls:[
|
|---|
| 20 | new OpenLayers.Control.Navigation(),
|
|---|
| 21 | new OpenLayers.Control.PanZoomBar()]});
|
|---|
| [5194] | 22 |
|
|---|
| [5183] | 23 | var mapnik = new OpenLayers.Layer.OSM();
|
|---|
| [5194] | 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);
|
|---|
| [5183] | 27 | var zoom = 15;
|
|---|
| 28 |
|
|---|
| 29 | map.addLayer(mapnik);
|
|---|
| [5195] | 30 |
|
|---|
| 31 | var markers = new OpenLayers.Layer.Markers("Markers");
|
|---|
| [5197] | 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 |
|
|---|
| [5195] | 36 | markers.addMarker(new OpenLayers.Marker(position, icon));
|
|---|
| 37 |
|
|---|
| 38 | map.addLayer(markers);
|
|---|
| 39 |
|
|---|
| 40 | map.setCenter(position, zoom);
|
|---|
| [5183] | 41 | }
|
|---|
| 42 | </script>
|
|---|
| [5194] | 43 |
|
|---|
| [5183] | 44 | </head>
|
|---|
| [5194] | 45 |
|
|---|
| 46 | <body onload="initialize(50.090956, 8.663283);">
|
|---|
| [5183] | 47 | <div id="basicMap"></div>
|
|---|
| 48 | </body>
|
|---|
| [5194] | 49 |
|
|---|
| [5183] | 50 | </html>
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.