[OpenLayers-Users] Re: Bing Zoom Layer and Google Zoom Layer aligning

Jean-François Gigand jf at geonef.fr
Tue Aug 23 09:38:23 EDT 2011


You said about the Bing layer: "the Z value is one less" [than Google].
What is the problem?
Bing layers start at resolution 78271.516953125, where Google starts
at 156543.03390625.

This means that for example, at zoom 8 with Google, the resolution is
305.74811309814453.
When you switch to Bing, 305.74811309814453 corresponds to the zoom 7.

Zooms depend on the baseLayer's maxResolution. Resolutions are more reliable.

About your OpenLayers.Layer.XYZ layer, I would recommand setting
'serverResolutions', so that the 'z' is derived from that, instead of
the map zoom (which depend on the baseLayer).
I had exactly the same problem is you a few weeks ago, and fixed it
with 'serverResolutions'.


Jean-François Gigand - Geonef
Paris, France - http://geonef.fr/




2011/8/23 static101 <jason at bt-systems.com>:
> Thank you for the helpful suggestions, but I am still not quite getting it.
> Closer I feel.
>
> Here is a copy of my code (I am only including relevant bits:
>  var options = {
>      controls: controls_array,
>      projection: new OpenLayers.Projection("EPSG:900913"),
>      displayProjection: new OpenLayers.Projection("EPSG:4326"),
>      units: "m",
>      maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34,
>                                       20037508.34, 20037508.34),
>      numZoomLevels: 8,
>      minResolution: 19.1092570679
>  };
>
>  map = new OpenLayers.Map('map_element',options);
>
>  var road = new OpenLayers.Layer.Bing({
>      key: bingApiKey,
>      type: "Road",
>      sphericalMercator: true,
>      numZoomLevels:8
>  });
>
>  var google_streets = new OpenLayers.Layer.Google(
>    "Google Streets",
>    {
>      type: google.maps.MapTypeId.ROADMAP,
>      sphericalMercator: true,
>      isBaseLayer: true
>    }
>  );
>
>  var oam = new OpenLayers.Layer.XYZ(
>      "CA Tiles",
>      "http://myurl.com/rt/mixed/current/tile-${z}-${x}-${y}.png",
>      {
>          sphericalMercator: true,
>          displayInLayerSwitcher: true,
>          visibility:true,
>          isBaseLayer:false,
>          alpha: true,
>          resolutions: [9783.93961875,4891.96980938,2445.98490469,
>                      1222.99245234,
>
> 611.496226172,305.748113086,152.874056543,76.4370282715,
>                      38.2185141357,19.1092570679]
>
>      }
>  );
>  map.addLayer(oam);
>
> Basically when I am zooming around at the most zoomed in on the controls,
> Google retrieves the tile: tile-9-82-199.png - this works correctly. I flip
> to the Bing layer, and it tries to retrieve tile-8-82.199.png - the Z value
> is one less. I cannot seem to get the zoom levels to be the same.
>
> Am I just doing something silly?
>
> --
> View this message in context: http://osgeo-org.1803224.n2.nabble.com/Bing-Zoom-Layer-and-Google-Zoom-Layer-aligning-tp6701507p6714369.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>


More information about the Users mailing list