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()
36 displayProjection: new OpenLayers.Projection("EPSG:4326")
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 displayOutsideMaxExtent: true,
45 attribution: attribution
48 } else if (args.layer == "cyclemap" || args.layer == "cycle map") {
49 var cyclemap = new OpenLayers.Layer.OSM.CycleMap("Cycle Map", {
50 displayOutsideMaxExtent: true,
52 attribution: attribution
54 map.addLayer(cyclemap);
55 } else if (args.layer == "transportmap") {
56 var transportmap = new OpenLayers.Layer.OSM.TransportMap("Transport Map", {
57 displayOutsideMaxExtent: true,
59 attribution: attribution
61 map.addLayer(transportmap);
62 } else if (args.layer == "mapquest") {
63 var mapquestmap = new OpenLayers.Layer.OSM("MapQuest Open Map", [
64 "http://otile1.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png",
65 "http://otile2.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png",
66 "http://otile3.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png",
67 "http://otile4.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png"], {
68 displayOutsideMaxExtent: true,
70 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'>"
72 map.addLayer(mapquestmap);
76 var markers = new OpenLayers.Layer.Markers();
77 map.addLayer(markers);
78 markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(args.marker[1], args.marker[0]).transform(map.displayProjection, map.getProjectionObject())));
83 var bounds = OpenLayers.Bounds.fromArray(args.bbox).transform(map.displayProjection, map.getProjectionObject());
84 map.zoomToExtent(bounds)
86 map.zoomToMaxExtent();
89 var size = map.getSize();
91 map.addControl(new OpenLayers.Control.PanZoomBar());
93 map.addControl(new OpenLayers.Control.Zoom());
100 <body onload="init()">