[OpenLayers-Users] Re: WMS over Google Maps when panning tiles not in synch

Andreas Hocevar ahocevar at opengeo.org
Tue Jul 26 06:40:22 EDT 2011


Hi,

OpenLayers.Layer.GoogleNG uses the GMaps API on a lower level, and doesn't switch to the 45° aerial view at high zoom levels. It wouldn't make much sense in 2D maps with overlays.

Andreas.

On Jul 25, 2011, at 22:00 , Alessandro Ferrucci wrote:

> Hey Thank you that worked.
> 
> I have another question.  I'm using google maps v3, when I used
> OpenLayers.Layer.Google with a Hybrid layer there were parts of the
> country (like Oakland california) where when I zoomed at the lowest
> level Google would automatically switch to Arial imagery.
> 
> When I use OpenLayers.Layer.GoogleNG (without switching the google API
> js link) this does not occur (google returns tiles in standard Hybrid
> top down view).  Do you know if OpenLayers is doing something special
> to cause this behavrior?
> 
> thanks
> Alessandro Ferrucci
> 
> On Sun, Jul 24, 2011 at 5:00 PM, Andreas Hocevar <ahocevar at opengeo.org> wrote:
>> If you're using OpenLayers trunk from svn, you can use OpenLayers.Layer.GoogleNG instead of OpenLayers.Layer.Google. All tiles will then move in sync. See http://openlayers.org/dev/examples/google-ng.html for an example.
>> 
>> Andreas.
>> 
>> On Jul 24, 2011, at 22:02 , Alessandro Ferrucci wrote:
>> 
>>> I am trying to verify that I don't see this behavior with google maps
>>> v2.  I switched the google maps script to specify v=2 but I still get
>>> the delayed tile dragging.
>>> 
>>> On Sun, Jul 24, 2011 at 3:56 PM, Alessandro Ferrucci
>>> <alessandroferrucci at gmail.com> wrote:
>>>> I am experiencing the exact same of what this ticket says:
>>>> 
>>>> http://trac.osgeo.org/openlayers/ticket/2929
>>>> 
>>>> does this mean that currently it's an issue in google maps v3?
>>>> 
>>>> Thanks,
>>>> Alessandro Ferrucci
>>>> 
>>>> On Sun, Jul 24, 2011 at 3:50 PM, Alessandro Ferrucci
>>>> <alessandroferrucci at gmail.com> wrote:
>>>>> Hello,
>>>>> I have the following code
>>>>> 
>>>>>       var map;
>>>>>            var projectionWGS84 = new OpenLayers.Projection("EPSG:4326");
>>>>>            var projectionMercator = new OpenLayers.Projection("EPSG:900913");
>>>>>            // Avoid pink error tiles
>>>>>            OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;
>>>>>            OpenLayers.Util.onImageLoadErrorColor = "transparent";
>>>>> 
>>>>>            function init(){
>>>>>                var options = {
>>>>>                    projection: new OpenLayers.Projection("EPSG:900913"),
>>>>>                    displayProjection: new OpenLayers.Projection("EPSG:4326"),
>>>>>                    units: "m",
>>>>>                    maxResolution: 156543.0339,
>>>>>                    maxExtent: new OpenLayers.Bounds(-20037508,
>>>>> -20037508,20037508, 20037508),
>>>>>                    restrictedExtent: new
>>>>> OpenLayers.Bounds(-164.88281,5.09094,-41.39648,52.69636).transform(projectionWGS84,projectionMercator),
>>>>>                    controls:[
>>>>>                        new OpenLayers.Control.Navigation(),
>>>>>                        new OpenLayers.Control.ArgParser(),
>>>>>                        new OpenLayers.Control.Attribution(),
>>>>>                        new OpenLayers.Control.PanZoomBar({ position:
>>>>> new OpenLayers.Pixel(2, 15) }),
>>>>>                        new OpenLayers.Control.Scale($('scale')),
>>>>>                        new OpenLayers.Control.LayerSwitcher(),
>>>>>                        new OpenLayers.Control.MousePosition(),
>>>>>                        new OpenLayers.Control.Permalink()
>>>>>                    ]
>>>>>                };
>>>>>                map = new OpenLayers.Map('map',options);
>>>>>                var googleHibridLayer = new OpenLayers.Layer.Google(
>>>>> "Google Hibrid", {type: google.maps.MapTypeId.HYBRID,
>>>>> 'sphericalMercator': true,isBaseLayer: true } );
>>>>>                var googleStreetLayer = new OpenLayers.Layer.Google(
>>>>> "Google Street", {'sphericalMercator':true} );
>>>>>                var addressLayer = new OpenLayers.Layer.WMS(
>>>>>                "Addresses", "<WMS SERVER HOSTNAME>",
>>>>>                {
>>>>>                    LAYERS: 'cira:address',
>>>>>                    STYLES: '',
>>>>>                    format: 'image/png',
>>>>>                    tiled: true,
>>>>>                    transparent:true,
>>>>>                    tilesOrigin : map.maxExtent.left + ',' +
>>>>> map.maxExtent.bottom
>>>>>                },
>>>>>                {
>>>>>                    buffer: 10,
>>>>>                    displayOutsideMaxExtent: true,
>>>>>                    isBaseLayer: false
>>>>>                }
>>>>>            );
>>>>> 
>>>>> map.addLayers([googleStreetLayer,googleHibridLayer,addressLayer]);
>>>>>                var USABounds=new
>>>>> OpenLayers.Bounds(-124.731,24.956,-66.97,49.372);
>>>>>                USABounds.transform(projectionWGS84,map.getProjectionObject());
>>>>>                map.zoomToExtent(USABounds);
>>>>>            }
>>>>> 
>>>>> The WMS looks to be overlaying fine, but when I pan the map the tiles
>>>>> look like they are "shifting plates" meaning they look like they are
>>>>> moving independently and it looks quite ugly.
>>>>> 
>>>>> I have tried adding "projection: new
>>>>> OpenLayers.Projection("EPSG:900913")," as an option to the WMS layer
>>>>> itself thinking maybe that would fix it but it did not.
>>>>> 
>>>>> I'm using stable Openlayers 2.10
>>>>> Any ideas?
>>>>> 
>>>>> Thank you,
>>>>> --
>>>>> Signed,
>>>>> Alessandro Ferrucci
>>>>> 
>>>> 
>>>> 
>>>> 
>>>> --
>>>> Signed,
>>>> Alessandro Ferrucci
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> Signed,
>>> Alessandro Ferrucci
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>> 
>> --
>> Andreas Hocevar
>> OpenGeo - http://opengeo.org/
>> Expert service straight from the developers.
>> 
>> 
> 
> 
> 
> -- 
> Signed,
> Alessandro Ferrucci

-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.



More information about the Users mailing list