[gdal-dev] strange wkt recognition
Javier Jimenez Shaw
j1 at jimenezshaw.com
Fri Jul 4 10:50:43 PDT 2025
Hi
I would like to understand why do I have different behaviour recognizing a
WKT between GDAL 3.9.2 and 3.11.1, both using PROJ 9.5.0 (using C++)
There is a clear mistake in the WKT bellow: EPSG:102641 . It should be
ESRI. But the source of the data was wrong, and we worked with that for a
long time.
PROJCS["NAD_1983_StatePlane_California_I_FIPS_0401_Feet",GEOGCS["GCS_North_American_1983",DATUM["North_American_Datum_1983",
SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Lambert_Conformal_Conic_2SP"],
PARAMETER["False_Easting",6561666.666666666],PARAMETER["False_Northing",1640416.666666667],PARAMETER["Central_Meridian",-122],
PARAMETER["Standard_Parallel_1",40],PARAMETER["Standard_Parallel_2",41.66666666666666],PARAMETER["Latitude_Of_Origin",39.33333333333334],
UNIT["Foot_US",0.30480060960121924],AUTHORITY["EPSG","102641"]]
and yes, ESRI version of WKT does not have AUTHORITY. Again, the data
source is what it is.
My failing test is because OGRCreateCoordinateTransformation called with
EPSG:4326 and calStatePlaneCS (created with SetFromUserInput) is failing.
The reason I found is in GetTextRepresentation in ogrct.cpp. There it
checks (if I understood correctly) if EPSG:102641 and the
OGRSpatialReference constructed from the string are equivalent.
In GDAL 3.9.2 the function IsSame is returning false, and
GetTextRepresentation is trying later with PROJJSON
In GDAL 3.11.1 the function IsSame returns true, and it is using
EPSG:102641, that fails later in OGRProjCT::Initialize (more in particular
in auto targetCRS = proj_create(ctx, pszTargetSRS);)
See that I am not changing the version of PROJ: 9.5.0
I have been looking for any change in GDAL code that would explain why the
wrong "WKT from California" behaves differently, but I couldn't find
anything. The changes in the code in ogrct.cpp and ogrspatialreference.cpp
that I think are involved are years old (just a thread safe lock changed).
But obviously I am missing something.
Could you help me?
Thanks.
Javier
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20250704/9df0fdf3/attachment.htm>
More information about the gdal-dev
mailing list