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,19 +266,26 @@ openstreetmap_jsc = """
function initialize(){ function initialize(){
var map = new OpenLayers.Map('place_canvas'); var map = new OpenLayers.Map('place_canvas');
var wms = new OpenLayers.Layer.WMS( var osm = new OpenLayers.Layer.OSM()
"OpenLayers WMS", map.addLayer(osm);
"http://maps.opengeo.org/geowebcache/service/wms",
{'layers':"openstreetmap", 'format': "image/png"});
map.addLayer(wms);
map.setCenter(new OpenLayers.LonLat(0, 0), 1); 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"); var markers = new OpenLayers.Layer.Markers("Markers");
markers.addMarker(new OpenLayers.Marker(lonLat));
map.addLayer(markers); map.addLayer(markers);
marker = new OpenLayers.Marker(new OpenLayers.LonLat(%s, %s)); // add overview control
markers.addMarker(marker); map.addControl(new OpenLayers.Control.OverviewMap());
// add a layer switcher
map.addControl(new OpenLayers.Control.LayerSwitcher()); map.addControl(new OpenLayers.Control.LayerSwitcher());
}""" }"""
@ -294,8 +301,8 @@ osm_markers = """
var wms = new OpenLayers.Layer.WMS( var wms = new OpenLayers.Layer.WMS(
"OpenLayers WMS", "OpenLayers WMS",
"http://vmap0.tiles.osgeo.org/wms/vmap0", "http://maps.opengeo.org/geowebcache/service/wms",
{'layers':'basic'}); {'layers':"openstreetmap", 'format': "image/png"});
map.addLayer(wms); map.addLayer(wms);
map.setCenter(new OpenLayers.LonLat(%s, %s), %d); map.setCenter(new OpenLayers.LonLat(%s, %s), %d);