[OpenLayers-Users] Hide and show layer results in wrong projection

Christopher Schmidt crschmidt at metacarta.com
Mon Sep 28 09:52:59 EDT 2009


On Mon, Sep 28, 2009 at 03:49:02PM +0200, Jelmer Baas wrote:
> Hello List,
> 
> I've been fiddling with OpenLayers for a bit now, and I'm very impressed
> with the results. The one big problem I keep having though, is related
> to (re)projection of my layers.
> 
> With two of my own layers in WGS84, I have no trouble. But now I try to
> use Google Maps as a background layer, and everything goes wrong. My
> country (The Netherlands) is a big wide blob all of the sudden.

In order to correctly overlay raster imagery on Google Maps, you must
use Spherical Mercator: 
  http://docs.openlayers.org/library/spherical_mercator.html

If you wish to approximate projecting correctly, you can set the
'reproject':true option on your WMS layer, but in order to use 
vector layers over Google Maps, you will need to use spherical mercator
anyway, so it might be best to just switch.

-- Chris

> The odd thing is that I somehow managed to fix this.... Until I hide and
> show the layer again. Then it's back to it's wrong state.
> 
> Can anyone shed some light on this? Or tell me what I'm doing wrong?
> 
> My test page is at http://www.cocontheweb.nl/_ftth/ and should display
> the Google layer with a yellow layer on top. Here you can also
> enable/disable the layer to see the result.
> 
> The map file (MapServer) has a "wms_srs" "EPSG:4326" tag, with each
> layer having "wms_srs" "EPSG:28992 EPSG:4326". 
> 
> Any help would be greatly appreciated,
> 
> Regards,
> Jelmer Baas
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users

-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list