]> git.openstreetmap.org Git - rails.git/blob - public/export/embed.html
Fixed for XHTML compliance. Based on patch from Alexander Delius.
[rails.git] / public / export / embed.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3   <head>
4     <title>OpenStreetMap Embedded</title>
5     <style type="text/css">
6         #map {
7             width: 100%;
8             height: 100%;
9         }
10         .olControlAttribution {
11             bottom: 3px!important;
12         }
13     </style>
14     <script src="http://openstreetmap.org/openlayers/OpenLayers.js" type="text/javascript"></script>
15     <script src="http://openstreetmap.org/openlayers/OpenStreetMap.js" type="text/javascript"></script>
16     <script type="text/javascript">
17     <!--
18         var map, layer;
19         function init(){
20             map = new OpenLayers.Map ("map", {
21               controls: [
22                   new OpenLayers.Control.Attribution(),
23                   new OpenLayers.Control.Navigation()
24               ],
25               maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,
26                                                20037508.34,20037508.34),
27               numZoomLevels: 20,
28               maxResolution: 156543.0339,
29               displayProjection: new OpenLayers.Projection("EPSG:4326"),
30               units: 'm',
31               projection: new OpenLayers.Projection("EPSG:900913")
32             });
33
34             var attribution = 'Data by <a target="_parent" href="http://www.openstreetmap.org">OpenStreetMap</a>';
35             var args = OpenLayers.Util.getParameters();
36             if (!args.layer || args.layer == "mapnik") {
37                 var mapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik", {
38                    displayOutsideMaxExtent: true,
39                    wrapDateLine: true,
40                    attribution: attribution
41                 });
42                 map.addLayer(mapnik);
43             } else if (args.layer == "osmarender") {
44                 var osmarender = new OpenLayers.Layer.OSM.Osmarender("Osmarender", {
45                    displayOutsideMaxExtent: true,
46                    wrapDateLine: true,
47                    attribution: attribution
48                 });
49                 map.addLayer(osmarender);
50             } else if (args.layer == "cycle map") {
51                 var cyclemap = new OpenLayers.Layer.OSM.CycleMap("Cycle Map", {
52                    displayOutsideMaxExtent: true,
53                    wrapDateLine: true,
54                    attribution: attribution
55                 });
56                 map.addLayer(cyclemap);
57             }
58
59             if (args.marker) {
60                 var markers = new OpenLayers.Layer.Markers();
61                 map.addLayer(markers);
62                 markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(args.marker[1], args.marker[0]).transform(map.displayProjection, map.getProjectionObject())));
63                 map.marker = true;
64             }
65
66             if (args.bbox) {
67                 var bounds = OpenLayers.Bounds.fromArray(args.bbox).transform(map.displayProjection, map.getProjectionObject());
68                 map.zoomToExtent(bounds)
69             } else {
70                 map.zoomToMaxExtent();
71             }
72
73             var size = map.getSize();
74             if (size.h > 320) {
75                 map.addControl(new OpenLayers.Control.PanZoomBar());
76             } else {
77                 map.addControl(new OpenLayers.Control.PanZoom());
78             }
79         }
80     // -->
81     </script>
82   </head>
83
84   <body onload="init()">
85     <div id="map"></div>
86   </body>
87 </html>