1 <html xmlns="http://www.w3.org/1999/xhtml">
3 <style type="text/css">
8 .olControlAttribution {
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">
16 function localUpdateLink() {
17 var center = this.map.getCenter();
19 // Map not initialized yet. Break out of this function.
24 var params = OpenLayers.Util.getParameters(this.base);
26 params.zoom = this.map.getZoom();
30 if (this.displayProjection) {
31 var mapPosition = OpenLayers.Projection.transform(
33 this.map.getProjectionObject(),
34 this.displayProjection );
39 params.lat = Math.round(lat*100000)/100000;
40 params.lon = Math.round(lon*100000)/100000;
43 if(href.indexOf('?') != -1) {
44 href = href.substring( 0, href.indexOf('?') );
47 href += '?' + OpenLayers.Util.getParameterString(params);
48 this.element.href = href;
52 OpenLayers.Lang.en.permalink = "Larger Map";
53 map = new OpenLayers.Map ("map", {
55 new OpenLayers.Control.Attribution(),
56 new OpenLayers.Control.Navigation(),
57 new OpenLayers.Control.Permalink(null, "http://openstreetmap.org/", { updateLink: localUpdateLink })
59 maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,
60 20037508.34,20037508.34),
62 maxResolution: 156543.0339,
63 displayProjection: new OpenLayers.Projection("EPSG:4326"),
65 projection: new OpenLayers.Projection("EPSG:900913")
68 var attribution = 'Data by <a target="_parent" href="http://www.openstreetmap.org">OpenStreetMap</a>';
69 var args = OpenLayers.Util.getParameters();
70 if (!args.layer || args.layer == "mapnik") {
71 var mapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik", {
72 displayOutsideMaxExtent: true,
74 attribution: attribution
78 var osmarender = new OpenLayers.Layer.OSM.Osmarender("Osmarender", {
79 displayOutsideMaxExtent: true,
81 attribution: attribution
83 map.addLayer(osmarender);
86 var markers = new OpenLayers.Layer.Markers();
87 map.addLayer(markers);
88 markers.addMarker( new OpenLayers.Marker(new OpenLayers.LonLat(args.marker[1], args.marker[0]).transform(map.displayProjection, map.getProjectionObject())));
92 var bounds = OpenLayers.Bounds.fromArray(args.bbox).transform(map.displayProjection, map.getProjectionObject());
93 map.zoomToExtent(bounds)
95 map.zoomToMaxExtent();
97 var size = map.getSize();
99 map.addControl(new OpenLayers.Control.PanZoomBar());
101 map.addControl(new OpenLayers.Control.PanZoom());
106 <body onload="init()">