[PROJ] Why do I have a exception: NoSuchAuthorityCodeException?

Евгений Соболев evgen_sobolev at mail.ru
Fri Apr 17 08:22:55 PDT 2020


  
>17 april 2020, 17:38 +03:00 от Even Rouault <even.rouault at spatialys.com>:
> 
>On jeudi 16 avril 2020 14:21:46 CEST Евгений Соболев wrote:
>> Hi.
>>  
>> I use function proj_create_crs_to_crs for create PJ* for transform:
>>     C = proj_context_create();
>>     char** paths = new char*[1];
>>     QString pathapp = QApplication::applicationDirPath()+ "/proj4_data" ; 
>>     paths[0] = _strdup(pathapp.toUtf8().constData());
>>     proj_context_set_search_paths(C, 1, paths);
>>     P = proj_create_crs_to_crs(C, "EPSG:4326", "EPSG:4923", NULL);
>>  
>> I have exception:  osgeo::proj::io::NoSuchAuthorityCodeException.
> 
>You mean that proj_create_crs_to_crs() throws a C++ exception that is propagated down though your code ? That shouldn't happen, as at the worse case they are caught by proj_create_crs_to_crs() itself. Or there's something really wrong with your build (or some situations like
>https://github.com/OSGeo/gdal/issues/2394 where a third-party library messes up with libstdc++)
> 
>But, internally, indeed proj_create_crs_to_crs(C, "EPSG:4326", "EPSG:4923", NULL) will at some point try to instanciate a projectedCRS and throw an exception, but it will be caught immediately by other PROJ code, so you shouldn't worry about that.

Yes, another PROJ code is handling this exception and everything works correctly. But these exceptions slow down the debugging of my code, as I often use the proj_create_crs_to_crs () function.

Is it normal practice to throw exceptions in the correct code?
 
Sobolev Evgeny
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20200417/7b4d506d/attachment.html>


More information about the PROJ mailing list