giving the overview example two maps
git-svn-id: http://svn.openlayers.org/trunk/openlayers@5114 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
+94
-45
@@ -1,47 +1,96 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
<html>
|
||||||
"http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-strict.dtd">
|
<head>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<title>Overview Map Example</title>
|
||||||
<head>
|
<script src="../lib/OpenLayers.js" type="text/javascript"></script>
|
||||||
<title>Overview Map Example</title>
|
<style>
|
||||||
<script src="../lib/OpenLayers.js" type="text/javascript"></script>
|
#map1 {
|
||||||
<style>
|
width: 500px;
|
||||||
#map{
|
height: 300px;
|
||||||
width:100%;
|
border: 1px solid gray;
|
||||||
height:500px;
|
}
|
||||||
border:1px solid;
|
#map2 {
|
||||||
}
|
width: 500px;
|
||||||
</style>
|
height: 300px;
|
||||||
</head>
|
border: 1px solid gray;
|
||||||
<body>
|
}
|
||||||
<div id="map"></div>
|
</style>
|
||||||
<script defer="defer" type="text/javascript">
|
</head>
|
||||||
var map = new OpenLayers.Map('map');
|
<body>
|
||||||
// my city
|
<div id="map1"></div>
|
||||||
var constantina = new OpenLayers.LonLat(-5.6165,37.8623);
|
<p>The above map has an overview map control that is created with
|
||||||
var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
the default options. Much like a regular map, the map contained by
|
||||||
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
|
the overview map control defaults to a geographic projection.</p>
|
||||||
var nasa_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
|
<div id="map2"></div>
|
||||||
"http://wms.jpl.nasa.gov/wms.cgi", {layers: "modis,global_mosaic"} );
|
<p>The second map has an overview map control that is created with
|
||||||
|
non-default options. In this case, the mapOptions property of the
|
||||||
map.addLayers([
|
control has been set to use non-default projection related properties.
|
||||||
nasa_wms,
|
In addition, any other properties of the overview map control can be
|
||||||
wms
|
set in this way.</p>
|
||||||
]);
|
<script defer="defer" type="text/javascript">
|
||||||
|
|
||||||
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
|
||||||
|
|
||||||
var options = {
|
|
||||||
layers: [wms.clone()],
|
|
||||||
minRatio: 8,
|
|
||||||
maxRatio: 128
|
|
||||||
};
|
|
||||||
var overview = new OpenLayers.Control.OverviewMap(options);
|
|
||||||
|
|
||||||
map.addControl(overview);
|
// create the top map (with default overview map control)
|
||||||
|
var map1 = new OpenLayers.Map('map1');
|
||||||
map.setCenter(constantina, 4);
|
|
||||||
|
var ol = new OpenLayers.Layer.WMS(
|
||||||
overview.maximizeControl();
|
"OpenLayers WMS",
|
||||||
</script>
|
"http://labs.metacarta.com/wms/vmap0",
|
||||||
</body>
|
{layers: 'basic'}
|
||||||
|
);
|
||||||
|
|
||||||
|
var jpl = new OpenLayers.Layer.WMS(
|
||||||
|
"NASA Global Mosaic",
|
||||||
|
"http://wms..nasa.gov/wms.cgi",
|
||||||
|
{layers: "modis,global_mosaic"}
|
||||||
|
);
|
||||||
|
|
||||||
|
map1.addLayers([ol, jpl]);
|
||||||
|
map1.addControl(new OpenLayers.Control.LayerSwitcher());
|
||||||
|
|
||||||
|
// create an overview map control with the default options
|
||||||
|
var overview1 = new OpenLayers.Control.OverviewMap();
|
||||||
|
map1.addControl(overview1);
|
||||||
|
|
||||||
|
map1.setCenter(new OpenLayers.LonLat(0, 0), 2);
|
||||||
|
|
||||||
|
// expand the overview map control
|
||||||
|
overview1.maximizeControl();
|
||||||
|
|
||||||
|
|
||||||
|
// create the bottom map (with advanced overview map control)
|
||||||
|
var mapOptions = {
|
||||||
|
maxExtent: new OpenLayers.Bounds(33861, 717605, 330846, 1019656),
|
||||||
|
maxResolution: 296985/1024,
|
||||||
|
projection: "EPSG:2805",
|
||||||
|
units: "m"
|
||||||
|
};
|
||||||
|
|
||||||
|
var map2 = new OpenLayers.Map('map2', mapOptions);
|
||||||
|
|
||||||
|
var bos = new OpenLayers.Layer.WMS(
|
||||||
|
"Boston",
|
||||||
|
"http://boston.freemap.in/cgi-bin/mapserv",
|
||||||
|
{
|
||||||
|
map: '/www/freemap.in/boston/map/gmaps.map',
|
||||||
|
layers: 'border,water,roads,rapid_transit,buildings',
|
||||||
|
format: 'png'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
map2.addLayers([bos]);
|
||||||
|
map2.addControl(new OpenLayers.Control.LayerSwitcher());
|
||||||
|
|
||||||
|
// create an overview map control with the default options
|
||||||
|
var controlOptions = {
|
||||||
|
mapOptions: mapOptions
|
||||||
|
}
|
||||||
|
var overview2 = new OpenLayers.Control.OverviewMap(controlOptions);
|
||||||
|
map2.addControl(overview2);
|
||||||
|
|
||||||
|
map2.setCenter(new OpenLayers.LonLat(182500, 868500), 3);
|
||||||
|
|
||||||
|
// expand the overview map control
|
||||||
|
overview2.maximizeControl();
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user