[gdal-dev] strange wkt recognition
Even Rouault
even.rouault at spatialys.com
Fri Jul 4 11:13:42 PDT 2025
Hi Javier,
the difference between 3.9.2 and 3.11 that explains what you see is :
https://github.com/OSGeo/gdal/commit/a4aa0b50154b0558e2677a31dde416452ac07c97
: "OGRSpatialReference::importFromEPSG(): tries with ESRI when it looks
like an ESRI code, but with a warning when that succeeds"
The issue is then that GDAL tries to pass EPSG:102641 to proj_create()
and proj_create() hasn't the above hack.
Fixed in https://github.com/OSGeo/gdal/pull/12705
Even
Le 04/07/2025 à 19:50, Javier Jimenez Shaw via gdal-dev a écrit :
> 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
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
--
http://www.spatialys.com
My software is free, but my time generally not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20250704/9c921b9f/attachment-0001.htm>
More information about the gdal-dev
mailing list