]> git.openstreetmap.org Git - rails.git/blob - public/export/embed.html
Use counter caches to improve spam scoring
[rails.git] / public / export / embed.html
1 <!DOCTYPE html>
2 <html xmlns="http://www.w3.org/1999/xhtml">
3   <head>
4     <meta charset="utf-8">
5     <title>OpenStreetMap Embedded</title>
6     <style type="text/css">
7         html {
8             width: 100%;
9             height: 100%;
10         }
11         body {
12             width: 100%;
13             height: 100%;
14             margin: 0px;
15         }
16         #map {
17             width: 100%;
18             height: 100%;
19         }
20         .olControlAttribution {
21             bottom: 3px!important;
22         }
23     </style>
24     <script src="/openlayers/OpenLayers.js" type="text/javascript"></script>
25     <script src="/openlayers/OpenStreetMap.js" type="text/javascript"></script>
26     <script type="text/javascript">
27     <!--
28         var map, layer;
29         function init(){
30             map = new OpenLayers.Map ("map", {
31               controls: [
32                   new OpenLayers.Control.Attribution(),
33                   new OpenLayers.Control.Navigation()
34               ],
35               numZoomLevels: 20,
36               displayProjection: new OpenLayers.Projection("EPSG:4326")
37             });
38
39             var attribution = '© <a target="_parent" href="http://www.openstreetmap.org">OpenStreetMap</a> and contributors, under an <a target="_parent" href="http://www.openstreetmap.org/copyright">open license</a>';
40             var args = OpenLayers.Util.getParameters();
41             if (!args.layer || args.layer == "mapnik" || args.layer == "osmarender") {
42                 var mapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik", {
43                    wrapDateLine: true,
44                    attribution: attribution
45                 });
46                 map.addLayer(mapnik);
47             } else if (args.layer == "cyclemap" || args.layer == "cycle map") {
48                 var cyclemap = new OpenLayers.Layer.OSM.CycleMap("Cycle Map", {
49                    wrapDateLine: true,
50                    attribution: attribution
51                 });
52                 map.addLayer(cyclemap);
53             } else if (args.layer == "transportmap") {
54                 var transportmap = new OpenLayers.Layer.OSM.TransportMap("Transport Map", {
55                    wrapDateLine: true,
56                    attribution: attribution
57                 });
58                 map.addLayer(transportmap);
59             } else if (args.layer == "mapquest") {
60                 var mapquestmap = new OpenLayers.Layer.OSM("MapQuest Open Map", [
61                     "http://otile1.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png",
62                     "http://otile2.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png",
63                     "http://otile3.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png",
64                     "http://otile4.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png"], {
65                    wrapDateLine: true,
66                    attribution: "Tiles courtesy of <a href='http://www.mapquest.com/' target='_blank'>MapQuest</a> <img src='http://developer.mapquest.com/content/osm/mq_logo.png'>"
67                 });
68                 map.addLayer(mapquestmap);
69             }
70
71             if (args.marker) {
72                 var markers = new OpenLayers.Layer.Markers();
73                 map.addLayer(markers);
74                 markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(args.marker[1], args.marker[0]).transform(map.displayProjection, map.getProjectionObject())));
75                 map.marker = true;
76             }
77
78             if (args.bbox) {
79                 var bounds = OpenLayers.Bounds.fromArray(args.bbox).transform(map.displayProjection, map.getProjectionObject());
80                 map.zoomToExtent(bounds)
81             } else {
82                 map.zoomToMaxExtent();
83             }
84
85             var size = map.getSize();
86             if (size.h > 320) {
87                 map.addControl(new OpenLayers.Control.PanZoomBar());
88             } else {
89                 map.addControl(new OpenLayers.Control.Zoom());
90             }
91         }
92     // -->
93     </script>
94   </head>
95
96   <body onload="init()">
97     <div id="map"></div>
98   </body>
99 </html>