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 if (this.map.marker) {
40 params.lat = Math.round(lat*100000)/100000;
41 params.lon = Math.round(lon*100000)/100000;
43 params.mlat = Math.round(lat*100000)/100000;
44 params.mlon = Math.round(lon*100000)/100000;
48 if(href.indexOf('?') != -1) {
49 href = href.substring( 0, href.indexOf('?') );
52 href += '?' + OpenLayers.Util.getParameterString(params);
53 this.element.href = href;
57 OpenLayers.Lang.en.permalink = "Larger Map";
58 map = new OpenLayers.Map ("map", {
60 new OpenLayers.Control.Attribution(),
61 new OpenLayers.Control.ArgParser(),
62 new OpenLayers.Control.Navigation(),
63 new OpenLayers.Control.Permalink(null, "http://openstreetmap.org/", { updateLink: localUpdateLink })
65 maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,
66 20037508.34,20037508.34),
68 maxResolution: 156543.0339,
69 displayProjection: new OpenLayers.Projection("EPSG:4326"),
71 projection: new OpenLayers.Projection("EPSG:900913")
74 var mapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik", {
75 displayOutsideMaxExtent: true,
77 attribution: '<a target="_parent" href="http://www.openstreetmap.org">OpenStreetMap</a>'
81 var osmarender = new OpenLayers.Layer.OSM.Osmarender("Osmarender", {
82 displayOutsideMaxExtent: true,
84 attribution: '<a target="_parent" href="http://www.openstreetmap.org">OpenStreetMap</a>'
86 map.addLayer(osmarender);
88 var args = OpenLayers.Util.getParameters();
89 if (args.marker && map.getCenter()) {
90 var markers = new OpenLayers.Layer.Markers();
91 map.addLayer(markers);
92 markers.addMarker( new OpenLayers.Marker(map.getCenter()));
96 if (!map.getCenter()) {
97 map.zoomToMaxExtent();
100 var size = map.getSize();
102 map.addControl(new OpenLayers.Control.PanZoomBar());
104 map.addControl(new OpenLayers.Control.PanZoom());
109 <body onload="init()">