2 <html xmlns="http://www.w3.org/1999/xhtml">
5 <title>OpenStreetMap Embedded</title>
6 <style type="text/css">
20 .olControlAttribution {
21 bottom: 3px!important;
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">
30 map = new OpenLayers.Map ("map", {
32 new OpenLayers.Control.Attribution(),
33 new OpenLayers.Control.Navigation()
35 maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,
36 20037508.34,20037508.34),
38 maxResolution: 156543.0339,
39 displayProjection: new OpenLayers.Projection("EPSG:4326"),
41 projection: new OpenLayers.Projection("EPSG:900913")
44 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>';
45 var args = OpenLayers.Util.getParameters();
46 if (!args.layer || args.layer == "mapnik" || args.layer == "osmarender") {
47 var mapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik", {
48 displayOutsideMaxExtent: true,
50 attribution: attribution
53 } else if (args.layer == "cyclemap" || args.layer == "cycle map") {
54 var cyclemap = new OpenLayers.Layer.OSM.CycleMap("Cycle Map", {
55 displayOutsideMaxExtent: true,
57 attribution: attribution
59 map.addLayer(cyclemap);
60 } else if (args.layer == "transportmap") {
61 var transportmap = new OpenLayers.Layer.OSM.TransportMap("Transport Map", {
62 displayOutsideMaxExtent: true,
64 attribution: attribution
66 map.addLayer(transportmap);
67 } else if (args.layer == "mapquest") {
68 var mapquestmap = new OpenLayers.Layer.OSM("MapQuest Open Map", [
69 "http://otile1.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png",
70 "http://otile2.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png",
71 "http://otile3.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png",
72 "http://otile4.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png"], {
73 displayOutsideMaxExtent: true,
75 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'>"
77 map.addLayer(mapquestmap);
81 var markers = new OpenLayers.Layer.Markers();
82 map.addLayer(markers);
83 markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(args.marker[1], args.marker[0]).transform(map.displayProjection, map.getProjectionObject())));
88 var bounds = OpenLayers.Bounds.fromArray(args.bbox).transform(map.displayProjection, map.getProjectionObject());
89 map.zoomToExtent(bounds)
91 map.zoomToMaxExtent();
94 var size = map.getSize();
96 map.addControl(new OpenLayers.Control.PanZoomBar());
98 map.addControl(new OpenLayers.Control.Zoom());
105 <body onload="init()">