[gdal-dev] exceptions when calling proj_create_crs_to_crs() with noop

Even Rouault even.rouault at spatialys.com
Sat Aug 19 09:51:08 PDT 2023


Michael,

You're not the only one to have reported such issue. Before 
https://github.com/OSGeo/PROJ/pull/3834 which will be in PROJ 9.3, this 
exception is expected. But even with current released versions, the 
exception is caught inside PROJ itself, before it reaches the caller of 
proj_create_crs_to_crs(), and thus it should not be noticed, unless you 
run PROJ under a debugger that catches C++ exceptions. If you receive it 
in a non-debugger environment, then there's something wrong somewhere in 
the building of PROJ (like if C++ exception handling would have been 
disabled?), or mixing it with other software (incompatible runtimes?). I 
haven't encountered such situation myself, and our CI either.

Even

Le 19/08/2023 à 13:16, Michael Katz via gdal-dev a écrit :
> When I call
>
> PJ *p = proj_create_crs_to_crs(
>     PJ_DEFAULT_CTX,
>     "+proj=longlat +ellps=GRS80 +no_defs",
> "+proj=longlat +datum=WGS84",
>     NULL );
>
> It returns a valid projections with the srs "+proj=noop". However, I 
> see that it throws four exceptions in the process, all like
>
> Exception thrown at 0x752D8712 in MARPLOT Server.exe: Microsoft C++ 
> exception: std::invalid_argument at memory location 0x0682C4B0.
>
> Unfortunately I don't have symbols tied to the built GDAL library I'm 
> using.
>
> Can you tell me if those exceptions are expected, if they indicate 
> something wrong, and if so how I should fix? (Obviously in this case I 
> could note that both srs have "+proj=longlat" in the string and not 
> create the projection at all, but I'd like to leave the code general 
> and let it handle this case with the noop.)
>
>
> _______________________________________________
> 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/20230819/6326bb67/attachment.htm>


More information about the gdal-dev mailing list