[OpenLayers-Users] Spherical Mercator 4326 Layers do not line up
Rohan Parkes
rohan.parkes at pelicancorp.com
Thu Aug 19 00:40:52 EDT 2010
I've seen this problem on some Spherical Mercator maps, but generally they
should line up. I notice that in Singapore, Google Satellite and Bing street
are out by a large amount that looks like a failure to apply the WGS84 datum
when calculating degrees lat lon.
If the problem is a datum shift, it might be possible to correct it by
converting the coordinates from Spherical degrees to WGS84 degrees. I do
this in a static map generator, where the formulae I was using gave
spherical degrees instead of real WGS degrees. I converted the spherical
degrees back to metres (i.e. 900913 projection), using the reverseMercator
formulae from the OL SphericalMercator source file. Then I converted the
metres to proper WGS84, using the Proj4 library. This might be kludgy, but
it works. (If anyone knows a more elegant way of doing it, I'd be grateful.)
However, just one thing - you have the units defined as 'ft' in your map
global options. I think this should be 'm'.
Rohan Parkes
From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] On
Behalf Of B. Heath Robinson
Sent: Sunday, 15 August 2010 06:38
To: users at openlayers.org
Subject: [OpenLayers-Users] Spherical Mercator 4326 Layers do not line up
I am having a problem with a WMS layer lining up on top of a Google map. It
appears to be about 15mi south of were it needs to be. I am assuming this
is because of the fact that spherical mercator ignores the fact the earth is
an ellipse. Anyway, I have included my openlayers code and my mapfile as
after spending hours search seems to be helpful.
I get the same results using either a shapfile or postgis data each with a
different projection.
I am using what I believe to be the best method. If I use "reproject:true"
the map does line up, but that causes other known problems and is
deprecated. Any help would be greatly appreciated.
---------Open Layers---------
function init(){
var options = {
projection: "EPSG:900913",
units: "ft",
maxResolution: 156543.0339,
maxExtent: new OpenLayers.Bounds(-20037508, -20037508,
20037508, 20037508)
};
map = new OpenLayers.Map('map', options);
var gmap = new OpenLayers.Layer.Google(
"Google Streets",
{'sphericalMercator': true}
);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100819/9e82cc8f/attachment.html
More information about the Users
mailing list