[OpenLayers-Dev] singleTile and Google Maps error
Julien-Samuel Lacroix
jlacroix at mapgears.com
Mon Mar 30 14:56:30 EDT 2009
Hi,
I have a problem with a singleTile WMS layer above Google Maps. I wanted
to check to see if anyone has seen it before or if there's a already a
ticket that I missed before investigating further.
The problem is when combining a google layer with a singleTile overlay,
when looking at the whole world, the overlay is displayed on the
right-hand side of the map and not in the current view. Sometimes it's
even way off the map.
From what I understood, OL tries to place the layer at the right place,
but the top-right coordinates it gets go behond the dateline and get
shifted to the right. Here's an example to reproduce:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="/openlayers/openlayers/lib/OpenLayers.js"></script>
<script
src='http://maps.google.com/maps?file=api&v=2&key=ABQIAAAACCFvpt30gpRs1CNZ1gCc_RTBfUk9TZrBRaIteybtnU2KziHEpRQjbtlKJwRisyazNeb0Lj9_OfGlMA'></script>
<script type="text/javascript">
var map, options;
function init()
{
var maxBounds = new OpenLayers.Bounds(-20000000, -8000000,
20000000, 15000000);
var options = {
projection: new OpenLayers.Projection("EPSG:900913"),
displayProjection: new OpenLayers.Projection("EPSG:4326"),
units: "m",
numZoomLevels: 19,
minScale: 120000000,
maxExtent: maxBounds
};
map = new OpenLayers.Map('map', options);
// create Google Mercator layers
var gmap = new OpenLayers.Layer.Google(
"Google Streets",
{'sphericalMercator': true}
);
// create WMS layer
var wms = new OpenLayers.Layer.WMS(
"World Map",
"http://labs.metacarta.com/wms/vmap0",
{'layers': 'basic'},
{
'opacity': 0.7,
'isBaseLayer': false,singleTile:true
}
);
map.addLayers([gmap, wms]);
map.zoomToMaxExtent();
}
</script>
</head>
<body onload="init()">
<div id="map" style="width:550px;height:300px"/>
</body>
</html>
--
Julien-Samuel Lacroix
Mapgears
http://www.mapgears.com/
More information about the Dev
mailing list