6148: OSM layer for OpenStreetMap

svn: r20606
This commit is contained in:
Jérôme Rapinat 2012-10-26 09:39:48 +00:00
parent 80d67a5e11
commit 695e6bfa65

View File

@ -266,20 +266,27 @@ openstreetmap_jsc = """
function initialize(){
var map = new OpenLayers.Map('place_canvas');
var wms = new OpenLayers.Layer.WMS(
"OpenLayers WMS",
"http://maps.opengeo.org/geowebcache/service/wms",
{'layers':"openstreetmap", 'format': "image/png"});
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...
@ -294,8 +301,8 @@ osm_markers = """
var wms = new OpenLayers.Layer.WMS(
"OpenLayers WMS",
"http://vmap0.tiles.osgeo.org/wms/vmap0",
{'layers':'basic'});
"http://maps.opengeo.org/geowebcache/service/wms",
{'layers':"openstreetmap", 'format': "image/png"});
map.addLayer(wms);
map.setCenter(new OpenLayers.LonLat(%s, %s), %d);