[gdal-dev] Reprojecting with Same Projection but Different Central_Meridians

Tom Hayden thayden at gmail.com
Wed Mar 15 21:13:59 PDT 2023


Hello - I apologize if this is not the right place to ask this question.
This is a question about a specific set of projections and coordinate
transformations using the osr/ogr libraries.

Suppose I have two projections where the only thing that differs is the
Central Meridian value. See below (these are from ArcGIS online by the way)

>>> p
'PROJCS["WGS_1984_Web_Mercator_Auxiliary_Sphere",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator_Auxiliary_Sphere"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-41.34804059746178],PARAMETER["Standard_Parallel_1",0.0],PARAMETER["Auxiliary_Sphere_Type",0.0],UNIT["Meter",1.0]]'
>>> p2 =
"""PROJCS["WGS_1984_Web_Mercator_Auxiliary_Sphere",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator_Auxiliary_Sphere"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",0.0],PARAMETER["Standard_Parallel_1",0.0],PARAMETER["Auxiliary_Sphere_Type",0.0],UNIT["Meter",1.0]]"""

I can load these
>>> srs2 = osr.SpatialReference(wkt=p2)
>>> srs = osr.SpatialReference(wkt=p)

And then attempt a transformation
>>> transform_func = osr.CoordinateTransformation(srs2, srs)
>>> u = ogr.Geometry(ogr.wkbPoint)
>>> u.AddPoint(0,0)
>>> u.Transfrom(transform_func)

But the end result is the same point that I originally put in.
>>> u.ExportToWkt()
'POINT (0 0 0)'

I would (I think?) expect to see a different x value, due to the changing
central meridian. In theory, the reprojected point should be offset some.
Maybe I'm missing something - is this a bug or am I mis-understanding the
role of Central Meridian in projections.

Regards

--
Tom Hayden
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20230315/eb8b1791/attachment.htm>


More information about the gdal-dev mailing list