]> git.openstreetmap.org Git - rails.git/blob - public/export/embed.html
Try and make message and comment notifications more idiot proof.
[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 if (args.layer == "osmarender") {
41                 var osmarender = new OpenLayers.Layer.OSM.Osmarender("Osmarender", {
42                    displayOutsideMaxExtent: true,
43                    wrapDateLine: true,
44                    attribution: attribution
45                 });
46                 map.addLayer(osmarender);
47             } else if (args.layer == "cycle map") {
48                 var cyclemap = new OpenLayers.Layer.OSM.CycleMap("Cycle Map", {
49                    displayOutsideMaxExtent: true,
50                    wrapDateLine: true,
51                    attribution: attribution
52                 });
53                 map.addLayer(cyclemap);
54             }
55
56             if (args.marker) {
57                 var markers = new OpenLayers.Layer.Markers();
58                 map.addLayer(markers);
59                 markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(args.marker[1], args.marker[0]).transform(map.displayProjection, map.getProjectionObject())));
60                 map.marker = true;
61             }
62
63             if (args.bbox) {
64                 var bounds = OpenLayers.Bounds.fromArray(args.bbox).transform(map.displayProjection, map.getProjectionObject());
65                 map.zoomToExtent(bounds)
66             } else {
67                 map.zoomToMaxExtent();
68             }
69
70             var size = map.getSize();
71             if (size.h > 320) {
72                 map.addControl(new OpenLayers.Control.PanZoomBar());
73             } else {
74                 map.addControl(new OpenLayers.Control.PanZoom());
75             }
76         }
77     </script>
78   </head>
79   <body onload="init()">
80     <div id="map"></div>
81   </body>
82 </html>