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

Jo Cook j.cook at oxfordarch.co.uk
Fri Apr 24 06:43:04 EDT 2009


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.

Thanks

Jo

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 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-tp2682471p2691763.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list