<HTML><BODY><div> <blockquote style="border-left:1px solid #0857A6; margin:10px; padding:0 0 0 10px;">17 april 2020, 17:38 +03:00 от Even Rouault <even.rouault@spatialys.com>:<br> <div id=""><div class="js-helper js-readmsg-msg"><style type="text/css"></style><div><div id="style_15871343081767632406_BODY"><div class="class_1587141108"><style type="text/css">.class_1587141108 p, .class_1587141108 li{
}</style><p style="-qt-block-indent:0; -qt-user-state:0; margin-bottom:0px; margin-left:0px; margin-right:0px; margin-top:0px; text-indent:0px">On jeudi 16 avril 2020 14:21:46 CEST Евгений Соболев wrote:</p><p style="-qt-block-indent:0; -qt-user-state:0; margin-bottom:0px; margin-left:0px; margin-right:0px; margin-top:0px; text-indent:0px">> Hi.</p><p style="-qt-block-indent:0; -qt-user-state:0; margin-bottom:0px; margin-left:0px; margin-right:0px; margin-top:0px; text-indent:0px">> </p><p style="-qt-block-indent:0; -qt-user-state:0; margin-bottom:0px; margin-left:0px; margin-right:0px; margin-top:0px; text-indent:0px">> I use function proj_create_crs_to_crs for create PJ* for transform:</p><p style="-qt-block-indent:0; -qt-user-state:0; margin-bottom:0px; margin-left:0px; margin-right:0px; margin-top:0px; text-indent:0px">> C = proj_context_create();</p><p style="-qt-block-indent:0; -qt-user-state:0; margin-bottom:0px; margin-left:0px; margin-right:0px; margin-top:0px; text-indent:0px">> char** paths = new char*[1];</p><p style="-qt-block-indent:0; -qt-user-state:0; margin-bottom:0px; margin-left:0px; margin-right:0px; margin-top:0px; text-indent:0px">> QString pathapp = QApplication::applicationDirPath()+ "/proj4_data" ; </p><p style="-qt-block-indent:0; -qt-user-state:0; margin-bottom:0px; margin-left:0px; margin-right:0px; margin-top:0px; text-indent:0px">> paths[0] = _strdup(pathapp.toUtf8().constData());</p><p style="-qt-block-indent:0; -qt-user-state:0; margin-bottom:0px; margin-left:0px; margin-right:0px; margin-top:0px; text-indent:0px">> proj_context_set_search_paths(C, 1, paths);</p><p style="-qt-block-indent:0; -qt-user-state:0; margin-bottom:0px; margin-left:0px; margin-right:0px; margin-top:0px; text-indent:0px">> P = proj_create_crs_to_crs(C, "EPSG:4326", "EPSG:4923", NULL);</p><p style="-qt-block-indent:0; -qt-user-state:0; margin-bottom:0px; margin-left:0px; margin-right:0px; margin-top:0px; text-indent:0px">> </p><p style="-qt-block-indent:0; -qt-user-state:0; margin-bottom:0px; margin-left:0px; margin-right:0px; margin-top:0px; text-indent:0px">> I have exception: osgeo::proj::io::NoSuchAuthorityCodeException.</p><p style="-qt-block-indent:0; -qt-paragraph-type:empty; margin-bottom:0px; margin-left:0px; margin-right:0px; margin-top:0px; text-indent:0px"> </p><p style="-qt-block-indent:0; -qt-user-state:0; margin-bottom:0px; margin-left:0px; margin-right:0px; margin-top:0px; text-indent:0px">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</p><p style="-qt-block-indent:0; -qt-user-state:0; margin-bottom:0px; margin-left:0px; margin-right:0px; margin-top:0px; text-indent:0px"><a href="https://github.com/OSGeo/gdal/issues/2394" target="_blank">https://github.com/OSGeo/gdal/issues/2394</a> where a third-party library messes up with libstdc++)</p><p style="-qt-block-indent:0; -qt-paragraph-type:empty; margin-bottom:0px; margin-left:0px; margin-right:0px; margin-top:0px; text-indent:0px"> </p><p style="-qt-block-indent:0; -qt-user-state:0; margin-bottom:0px; margin-left:0px; margin-right:0px; margin-top:0px; text-indent:0px">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.</p></div></div></div></div></div></blockquote><div><br>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.</div><div><br>Is it normal practice to throw exceptions in the correct code?</div><div> </div><div>Sobolev Evgeny</div><div> </div></div></BODY></HTML>