]> git.openstreetmap.org Git - rails.git/blob - public/export/embed.html
You can now test nodes. This test needs looked at again, as it currently doesn't...
[rails.git] / public / export / embed.html
1 <html xmlns="http://www.w3.org/1999/xhtml">
2   <head>
3     <style type="text/css">
4         #map {
5             width: 100%;
6             height: 100%;
7         }
8         .olControlAttribution {
9             bottom: 3px!important;
10         }
11     </style>
12     <script src="http://openstreetmap.org/openlayers/OpenLayers.js"></script>
13     <script src="http://openstreetmap.org/openlayers/OpenStreetMap.js"></script>
14     <script type="text/javascript">
15         var map, layer;
16         function init(){
17             map = new OpenLayers.Map ("map", {
18               controls: [
19                   new OpenLayers.Control.Attribution(),
20                   new OpenLayers.Control.Navigation()
21               ],
22               maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,
23                                                20037508.34,20037508.34),
24               numZoomLevels: 20,
25               maxResolution: 156543.0339,
26               displayProjection: new OpenLayers.Projection("EPSG:4326"),
27               units: 'm',
28               projection: new OpenLayers.Projection("EPSG:900913")
29             });
30
31             var attribution = 'Data by <a target="_parent" href="http://www.openstreetmap.org">OpenStreetMap</a>';
32             var args = OpenLayers.Util.getParameters();
33             if (!args.layer || args.layer == "mapnik") {
34                 var mapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik", {
35                    displayOutsideMaxExtent: true,
36                    wrapDateLine: true,
37                    attribution: attribution
38                 });
39                 map.addLayer(mapnik);
40             } else {
41                 var osmarender = new OpenLayers.Layer.OSM.Osmarender("Osmarender", {
42                    displayOutsideMaxExtent: true,
43                    wrapDateLine: true,
44                    attribution: attribution
45                 });
46                 map.addLayer(osmarender);
47             }
48
49             if (args.marker) {
50                 var markers = new OpenLayers.Layer.Markers();
51                 map.addLayer(markers);
52                 markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(args.marker[1], args.marker[0]).transform(map.displayProjection, map.getProjectionObject())));
53                 map.marker = true;
54             }
55
56             if (args.bbox) {
57                 var bounds = OpenLayers.Bounds.fromArray(args.bbox).transform(map.displayProjection, map.getProjectionObject());
58                 map.zoomToExtent(bounds)
59             } else {
60                 map.zoomToMaxExtent();
61             }
62
63             var size = map.getSize();
64             if (size.h > 320) {
65                 map.addControl(new OpenLayers.Control.PanZoomBar());
66             } else {
67                 map.addControl(new OpenLayers.Control.PanZoom());
68             }
69         }
70     </script>
71   </head>
72   <body onload="init()">
73     <div id="map"></div>
74   </body>
75 </html>