[OpenLayers-Users] displacement of google satellite data
compared to google streetmap
RFeagin
ryan.feagin at PEACHTREEGEOGRAPHICS.COM
Thu Apr 23 15:27:05 EDT 2009
as a really stupid work around, try catching the changebaselayer event. Then
map.pan(-1,-1); That worked for me with the popup issue I reported.
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-tp2682471p2685412.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list