From ce5adbebe98c4fb37d14c4c74925c14fbf993b1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Rapinat?= Date: Fri, 26 Oct 2012 09:31:20 +0000 Subject: [PATCH] 6148: OSM layer for OpenStreetMap svn: r20605 --- src/plugins/webreport/NarrativeWeb.py | 29 +++++++++++++++++---------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/plugins/webreport/NarrativeWeb.py b/src/plugins/webreport/NarrativeWeb.py index d0c1e050c..7da4c11a7 100644 --- a/src/plugins/webreport/NarrativeWeb.py +++ b/src/plugins/webreport/NarrativeWeb.py @@ -259,21 +259,28 @@ openstreetmap_jsc = """ function initialize(){ var map = new OpenLayers.Map('place_canvas'); - - var wms = new OpenLayers.Layer.WMS( - "OpenLayers WMS", - "http://vmap0.tiles.osgeo.org/wms/vmap0", - {'layers':'basic'}); - map.addLayer(wms); - - map.setCenter(new OpenLayers.LonLat(0, 0), 1); + + var osm = new OpenLayers.Layer.OSM() + map.addLayer(osm); + + var lonLat = new OpenLayers.LonLat(%s, %s) + .transform( + new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984 + map.getProjectionObject() // to Spherical Mercator Projection + ); + var zoom =16; + + map.setCenter(lonLat, zoom); var markers = new OpenLayers.Layer.Markers("Markers"); + markers.addMarker(new OpenLayers.Marker(lonLat)); map.addLayer(markers); - marker = new OpenLayers.Marker(new OpenLayers.LonLat(%s, %s)); - markers.addMarker(marker); - map.addControl(new OpenLayers.Control.LayerSwitcher()); + // add overview control + map.addControl(new OpenLayers.Control.OverviewMap()); + + // add a layer switcher + map.addControl(new OpenLayers.Control.LayerSwitcher()); }""" # javascript for OpenStreetMap's markers...