Begin work on Google Maps Layer. In order to create this layer, layer div creation has been moved into Layer.js, and the div that is created is then slotted into the right place by the map.addLayer function. (This is so that, at layer creation time, a div is available). However, it seems like Google Maps does not know how large the div is for reasons I don't yet understand, and there'se also the fact that our zoom levels differ from Google's at the moment. But it's getting there.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@29 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2006-05-13 16:11:52 +00:00
parent 7b62f33544
commit 46035298a5
5 changed files with 62 additions and 2 deletions

40
google.html Normal file
View File

@@ -0,0 +1,40 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="imagetoolbar" content="no"> <!--ie image gizmo OFF!-->
<style type="text/css">
#map {
width: 800px;
height: 475px;
border: 1px solid black;
background-color: red;
}
</style>
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhQbadBmKcUIPHxSF0F5bD4xQY6ODhQsIZ7vSYVQ9GdAJRHatRM4NCVF9w"
type="text/javascript"></script>
<script src="lib/OpenLayers.js"></script>
<script type="text/javascript">
<!--
var lat = 40;
var lon = 5;
var zoom = 5;
var map, layer;
function init(){
map = new OpenLayers.Map( $('map') );
gmap = new OpenLayers.Layer.Google( "Google" );
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://octo.metacarta.com/cgi-bin/mapserv",
{map: '/mapdata/vmap_wms.map', layers: 'basic', format: 'image/jpeg'} );
map.setCenter(new OpenLayers.LatLon(lat, lon), zoom);
map.addLayer(layer);
map.addLayer(gmap);
}
// -->
</script>
</head>
<body onload="init()">
<h1>OpenLayers Example</h1>
<div id="map"></div>
</body>
</html>