Making it so the Google layer is not visible if used as an overlay with visibility false. Container is offset to allow proper calculation of size. r=ahocevar (closes #2730)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@10480 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
29
examples/all-overlays-google.html
Normal file
29
examples/all-overlays-google.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>OpenLayers All Overlays with Google and OSM</title>
|
||||
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
|
||||
<link rel="stylesheet" href="../theme/default/google.css" type="text/css">
|
||||
<link rel="stylesheet" href="style.css" type="text/css">
|
||||
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script src="all-overlays-google.js"></script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h1 id="title">All Overlays with Google and OSM</h1>
|
||||
<p id="shortdesc">
|
||||
Using the Google and OSM layers as overlays.
|
||||
</p>
|
||||
<div id="map" class="smallmap"></div>
|
||||
<div id="docs">
|
||||
<p>
|
||||
Using the allOverlays property on the map, the first layer added
|
||||
must initially be visible. This example demonstrates the use of
|
||||
a Google layer and an OSM layer treated as overlays.
|
||||
</p><p>
|
||||
See the <a href="all-overlays-google.js" target="_blank">
|
||||
all-overlays-google.js source</a> to see how this is done.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
19
examples/all-overlays-google.js
Normal file
19
examples/all-overlays-google.js
Normal file
@@ -0,0 +1,19 @@
|
||||
var map;
|
||||
|
||||
function init() {
|
||||
|
||||
map = new OpenLayers.Map({
|
||||
div: "map",
|
||||
allOverlays: true
|
||||
});
|
||||
|
||||
var osm = new OpenLayers.Layer.OSM();
|
||||
var gmap = new OpenLayers.Layer.Google("Google Streets", {visibility: false});
|
||||
|
||||
// note that first layer must be visible
|
||||
map.addLayers([osm, gmap]);
|
||||
|
||||
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
||||
map.zoomToMaxExtent();
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user