Projection problem with Virtual Earth / Google maps

Frank Warmerdam warmerdam at POBOX.COM
Tue Jan 15 10:43:49 EST 2008


James Mapserver wrote:
> 
> Projection problems with Google maps / Virtual Earth
> I don't really understand whats happening here - so would be grateful 
> for any suggestions.
> I have 2 .map files serving out WMS data:
>  - BNG.map
>  - WGS84.map

James,

Are you building MapServer from source yourself?  If so, could you possibly
try upgrading to PROJ 4.6.0?  This release makes a fundamental change in
how changes of ellipsoid that lack datum shift parameters are done that
may be at the root of your problem.  Alternatively, if you stick with an
older PROJ.4 please read the last question in the PROJ FAQ:

   http://proj.maptools.org/faq.html

Hmm, on reflection the problem is more likely that *no* datum shift
is being done when going from the OSGB 1936 datum underlying the BNG
projection.  Ideally what you would like it to do is apply a datum
shift from OSGB 1936.  The EPSG lookup file does not have a datum shift
for EPSG:27700 but I think a reasonable good one is:

   +towgs84=446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894

Consider adding that into the <27700> entry in the EPSG init file.

I'm sorry, but I lack time for a deeper analysis.  I hope this will give
you something to work with.

Best regards,

> Both these map files are displaying the same data - but one has the raw 
> data as British National Grid (epsg 27700) and the other as WGS84 (epsf 
> 4326)
> When tested in a client such as MapInfo - alignment is exact for both
> However when displayed on virtual earth / google maps (using the 
> projection <54004> +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 
> +lon_0=0.0 +x_0=0.0 +y_0=35 +k=1.0 +units=m +no_defs <>)
> if using the WMS service from the WGS84.map file - alignment is fine
> if using the WMS service from the BNG.map file - the overlay is about 
> 100m off to NW
> What I don't understand is why these both work fine in a client such as 
> MapInfo, but only one fails in Virtual Earth / Google maps - as one 
> works presumably I've got this working OK ?
> The difference is both that when being called from MapInfo the request 
> uses SRS=27700 so no conversion is required
> It seems as if the conversion from 27700 to 54004 is messing up - but 
> 4326 to 54004 works OK ?
>  
> OK - looked a bit deeper in MapInfo - and if I change the WMS request 
> from the BNG.map file to return data as SRS=4326 (as in the query below) 
> - I get similar miss alignment
>  
> GET 
> /scripts/mapserv.exe?map=C:/Inetpub/wwwroot/MapserverService/Map/WMSTest.map&LAYERS=OSBUILD&VERSION= 
> 1.1.1&REQUEST=GetMap&LAYERS=OSBUILD&STYLES=&SRS=EPSG:4326&BBOX=-3.296092,51.945322,- 
> 3.290018,51.949813&WIDTH=971&HEIGHT=718&FORMAT=image/png&TRANSPARENT=TRUE&BGCOLOR=0xFFFFFF&EXCEPTIONS=application/vnd.ogc.se_xml 
> HTTP/1.1
>  
> I don't remeber having these issues when using mapserver via CGI - it 
> only seems to relate to WMS
>  
> Obviously I can convert all my data to WGS84 and avoid the problem - but 
> thats not an ideal long term solution
>  
> Any ideas
> 
> Thanks
> James
> 


-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org



More information about the mapserver-users mailing list