[OpenLayers-Users] How can I assign different map centers for
different map layers ?
HarryS
mapcollect at gmx.net
Tue Nov 13 08:09:03 EST 2007
Hello,
I have a map with 2 different map layers . The 2 map layers have different
extents, e.g. one map layer is an Africa map and the other layer is an
Australia map. When the client toggles between these layers the maps shall
always center to predefined locations (e.g. (20,15) for Africa and (145,-25)
for Australia map).
Can anybody help me please to solve this problem for a map similar to this:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
#map {
width: 800px;
height: 475px;
border: 1px solid black;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
var map;
function init(){
map = new OpenLayers.Map('map');
var jpl_wms = new OpenLayers.Layer.KaMap( "Satellite",
"http://www.openlayers.org/world/index.php", {g:
"satellite", map: "world"});
var dm_wms = new OpenLayers.Layer.WMS( "Canada",
"http://www2.dmsolutions.ca/cgi-bin/mswms_gmap",
{layers: "bathymetry,land_fn,park,drain_fn,drainage," +
"prov_bound,fedlimit,rail,road,popplace",
transparent: "true", format: "image/png" });
map.addLayers([jpl_wms, dm_wms]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.zoomToMaxExtent();
}
</script>
</head>
<body onload="init()">
<h1>OpenLayers Example</h1>
<div id="map"></div>
</body>
</html>
Regards,
Harald Schmidt
--
View this message in context: http://www.nabble.com/How-can-I-assign-different-map-centers-for-different-map-layers---tf4797627.html#a13725385
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list