[OpenLayers-Dev] singleTile and Google Maps error

Christopher Schmidt crschmidt at metacarta.com
Mon Mar 30 18:17:48 EDT 2009


On Mon, Mar 30, 2009 at 02:56:30PM -0400, Julien-Samuel Lacroix wrote:
> 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:

Yes, this is a problem. No, I don't have a suggested solution (other
than 'use tiles').

-- Chris

> 
> <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&amp;v=2&amp;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/
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev

-- 
Christopher Schmidt
MetaCarta



More information about the Dev mailing list