[OpenLayers-Commits] r5114 - trunk/openlayers/examples
commits at openlayers.org
commits at openlayers.org
Mon Nov 5 12:41:41 EST 2007
Author: tschaub
Date: 2007-11-05 12:41:39 -0500 (Mon, 05 Nov 2007)
New Revision: 5114
Modified:
trunk/openlayers/examples/overviewmap.html
Log:
giving the overview example two maps
Modified: trunk/openlayers/examples/overviewmap.html
===================================================================
--- trunk/openlayers/examples/overviewmap.html 2007-11-05 16:02:29 UTC (rev 5113)
+++ trunk/openlayers/examples/overviewmap.html 2007-11-05 17:41:39 UTC (rev 5114)
@@ -1,47 +1,96 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title>Overview Map Example</title>
-<script src="../lib/OpenLayers.js" type="text/javascript"></script>
-<style>
-#map{
- width:100%;
- height:500px;
- border:1px solid;
-}
-</style>
-</head>
-<body>
- <div id="map"></div>
- <script defer="defer" type="text/javascript">
- var map = new OpenLayers.Map('map');
- // my city
- var constantina = new OpenLayers.LonLat(-5.6165,37.8623);
- var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
- "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
- var nasa_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
- "http://wms.jpl.nasa.gov/wms.cgi", {layers: "modis,global_mosaic"} );
+<html>
+ <head>
+ <title>Overview Map Example</title>
+ <script src="../lib/OpenLayers.js" type="text/javascript"></script>
+ <style>
+ #map1 {
+ width: 500px;
+ height: 300px;
+ border: 1px solid gray;
+ }
+ #map2 {
+ width: 500px;
+ height: 300px;
+ border: 1px solid gray;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="map1"></div>
+ <p>The above map has an overview map control that is created with
+ the default options. Much like a regular map, the map contained by
+ the overview map control defaults to a geographic projection.</p>
+ <div id="map2"></div>
+ <p>The second map has an overview map control that is created with
+ non-default options. In this case, the mapOptions property of the
+ control has been set to use non-default projection related properties.
+ In addition, any other properties of the overview map control can be
+ set in this way.</p>
+ <script defer="defer" type="text/javascript">
+
+ // create the top map (with default overview map control)
+ var map1 = new OpenLayers.Map('map1');
+
+ var ol = new OpenLayers.Layer.WMS(
+ "OpenLayers WMS",
+ "http://labs.metacarta.com/wms/vmap0",
+ {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"
+ };
- map.addLayers([
- nasa_wms,
- wms
- ]);
-
- map.addControl(new OpenLayers.Control.LayerSwitcher());
-
- var options = {
- layers: [wms.clone()],
- minRatio: 8,
- maxRatio: 128
- };
- var overview = new OpenLayers.Control.OverviewMap(options);
+ var map2 = new OpenLayers.Map('map2', mapOptions);
- map.addControl(overview);
-
- map.setCenter(constantina, 4);
-
- overview.maximizeControl();
- </script>
-</body>
+ 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>
More information about the Commits
mailing list