[OpenLayers-Users] displacement of google satellite data compared to google streetmap

joncoign jncoign at Knology.net
Tue May 5 15:20:25 EDT 2009


I have also seen some really odd behavior out of the Google layers if there
is a DIV anywhere around the map with position:static. I am planning to do
some more research into this, but as a quick workaround I have had to put
the map outside of the popups layout and then dynamically position it on top
of the content area on a higher z value to work around this. 




Jo Cook wrote:
> 
> Hi Andreas,
> 
> Yes, adding this code in a simple page with a fixed size map div worked
> fine, no displacement. I will experiment more with the mapfish setup, and
> bring this up on the mapfish list if I can't figure it out.
> 
> Thanks for your help
> 
> Jo
> ----- Original Message -----
> From: "Andreas Hocevar (via Nabble)"
> <ml-user+67559-1830404419 at n2.nabble.com>
> To: "Jo Cook" <j.cook at oxfordarch.co.uk>
> Sent: Friday, 24 April, 2009 21:35:30 GMT +00:00 GMT Britain, Ireland,
> Portugal
> Subject: Re: [OpenLayers-Users] displacement of google satellite data
> compared to google streetmap
> 
> Jo Cook wrote: 
>> Hi Andreas, 
>> 
>> I've tried your new patch for bug 1797 but it doesn't do anything for me.
>> I 
>> don't know if it's because I'm not seeing this problem when I resize the 
>> map, but when I simply switch layers. I'm not using a vector layer over
>> the 
>> top, just a WMS (non baselayer), so I haven't seen the issues with popup 
>> alignment. 
>> 
> 
> So it seems your issue is a different one. Maybe you have some weird css 
> on the page where you place the map? Try to use the code you posted 
> below in an empty html page without css and just a map div. 
> 
> Other than that, does the workaround to specify the map div's width and 
> height in pixels work for you? 
> 
> Regards, 
> Andreas. 
> 
> 
>> Andreas Hocevar-2 wrote: 
>> 
>>> Hi, 
>>> 
>>> this is a known issue, unfortunately without a good solution at the 
>>> moment: 
>>> http://trac.openlayers.org/ticket/1797 
>>> http://trac.openlayers.org/ticket/2055 
>>> 
>>> A workaround is to specify the map div's width and height in pixels. 
>>> 
>>> Regards, 
>>> Andreas. 
>>> 
>>> Joanne Cook wrote: 
>>> 
>>>> Hi List, 
>>>> 
>>>> I have a map that I thought was all correctly set up to use spherical 
>>>> mercator, and all my data (which is all projected in 900913) is
>>>> correctly 
>>>> displaying on either open streetmap or google streets data. However,
>>>> when 
>>>> I add a google satellite or hybrid layer, the initial load of the map 
>>>> shows the satellite layer displaced several hundred miles to the west.
>>>> If 
>>>> I switch to the google streets layer without any zooming or panning,
>>>> the 
>>>> displacement disappears. If I then switch back to the google satellite 
>>>> layer, again with no zooming or panning, it appears in the correct
>>>> place. 
>>>> Throughout all of this, my data layer has no displacement. Furthermore, 
>>>> since all of this is set within mapfish, with extjs used for side
>>>> panels, 
>>>> if I minimise the side panel while the displacement is occurring it
>>>> also 
>>>> removes the displacement. I'm using the svn versions of openlayers and 
>>>> mapfish. 
>>>> 
>>>> This is the code relating to setting up the map and layers: 
>>>> 
>>>> function createMap() { 
>>>> var options = { 
>>>> projection: new OpenLayers.Projection("EPSG:900913"), 
>>>> displayProjection: new OpenLayers.Projection("EPSG:27700"), 
>>>> units: "m", 
>>>> maxResolution: 156543.0339, 
>>>> maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 
>>>> 20037508.34, 
>>>> 20037508.34) 
>>>> }; 
>>>> return new OpenLayers.Map('olmap',options); 
>>>> } //end createmap 
>>>> 
>>>> function addlayers(map){ 
>>>> 
>>>> 
>>>> // define wms 
>>>> layer = new OpenLayers.Layer.WMS("OA Sites WMS", 
>>>> " http://geoserver.thehumanjourney.net:80/geoserver/wms ?", 
>>>> {layers: 'oadigi:oasites', transparent: true, 
>>>> format: 'image/png', buffer:0}, 
>>>> {isBaseLayer: false}); 
>>>> 
>>>> 
>>>> 
>>>> // create Google Mercator layers 
>>>> var gmap = new OpenLayers.Layer.Google( 
>>>> "Google Streets", 
>>>> {'sphericalMercator': true} 
>>>> ); 
>>>> var gsat = new OpenLayers.Layer.Google( 
>>>> "Google Satellite", 
>>>> {type: G_SATELLITE_MAP, 'sphericalMercator': true, 
>>>> numZoomLevels: 22} 
>>>> ); 
>>>> var ghyb = new OpenLayers.Layer.Google( 
>>>> "Google Hybrid", 
>>>> {type: G_HYBRID_MAP, 'sphericalMercator': true} 
>>>> ); 
>>>> 
>>>> 
>>>> // define pseudo-layer for highlighting selected features 
>>>> select = new OpenLayers.Layer.Vector("Selection", 
>>>> {protocol: new mapfish.Protocol.TriggerEventDecorator(protocol), 
>>>> strategies: [new mapfish.Strategy.ProtocolListener({append: true})], 
>>>> styleMap: new 
>>>> OpenLayers.Style(OpenLayers.Feature.Vector.style["select"]), 
>>>> displayInLayerSwitcher: false}); 
>>>> 
>>>> 
>>>> // add layers 
>>>> map.addLayers([layer, select, gmap, gsat, ghyb]); 
>>>> 
>>>> } //end addlayers 
>>>> 
>>>> function setMapCenter() { 
>>>> //define a new projection object so map can be centred using latlong 
>>>> var proj = new OpenLayers.Projection("EPSG:4326"); 
>>>> var point = new OpenLayers.LonLat(-2.9, 53.6); 
>>>> this.setCenter(point.transform(proj, this.getProjectionObject()), 6); 
>>>> } //end setMapCenter 
>>>> 
>>>> I hope that's enough information for someone as it's hard for me to get 
>>>> this map accessible to the outside world yet. 
>>>> 
>>>> Many thanks 
>>>> 
>>>> Jo 
>>>> 
>>>> 
>>>> 
>>> -- 
>>> Andreas Hocevar 
>>> OpenGeo - http://opengeo.org/ 
>>> Expert service straight from the developers. 
>>> 
>>> _______________________________________________ 
>>> Users mailing list 
>>> Users at ... 
>>> http://openlayers.org/mailman/listinfo/users 
>>> 
>>> 
>>> 
>> 
>> 
> _______________________________________________ 
> Users mailing list 
> Users at ... 
> http://openlayers.org/mailman/listinfo/users 
> 
> 
> 
> 
> This email is a reply to your post @
> http://n2.nabble.com/displacement-of-google-satellite-data-compared-to-google-streetmap-tp2682471p2698857.html 
> You can reply by email or by visting the link above. 
> 
> -- 
> -----------------------------------------------------
> Joanne Cook
> Senior IT Support and Development
> Oxford Archaeology (North)
> 01524 880212
> http://thehumanjourney.net
> 
> 
> ------
> Files attached to this email may be in ISO 26300 format (OASIS Open
> Document Format). If you have difficulty opening them, please visit
> http://iso26300.info for more information.
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> 

-- 
View this message in context: http://n2.nabble.com/displacement-of-google-satellite-data-compared-to-google-streetmap-tp2682471p2803669.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list