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

Rahkonen Jukka jukka.rahkonen at maanmittauslaitos.fi
Thu Mar 16 00:37:46 PDT 2023


Hi,

I apologize that I don’t know Python, but I saved the projection strings into files and made a test with gdaltransform

gdaltransform -s_srs proj1.prj -t_srs proj2.prj
Enter X Y [Z [T]] values separated by space, and press Return.
0 0
-4602842.82460905 0 0

Maybe your code does not do what you think it does.

-Jukka Rahkonen-

Lähettäjä: gdal-dev <gdal-dev-bounces at lists.osgeo.org> Puolesta Tom Hayden
Lähetetty: torstai 16. maaliskuuta 2023 6.14
Vastaanottaja: gdal-dev at lists.osgeo.org
Aihe: [gdal-dev] Reprojecting with Same Projection but Different Central_Meridians

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/20230316/3d6dc2e9/attachment-0001.htm>


More information about the gdal-dev mailing list