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