<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">I understand (in an “I understand your premises but don’t share them” kind of way) the push back from the real live geodesists, but if PROJ doesn’t provide, then every downstream project is going to end up with one of these<div class=""><br class=""></div><div class=""><a href="https://github.com/postgis/postgis/blob/svn-trunk/liblwgeom/lwgeom_transform.c#L298-L343" class="">https://github.com/postgis/postgis/blob/svn-trunk/liblwgeom/lwgeom_transform.c#L298-L343</a></div><div class=""><br class=""></div><div class="">P.<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Apr 2, 2019, at 11:08 AM, Oliver Eichler <<a href="mailto:oliver.eichler@dspsolutions.de" class="">oliver.eichler@dspsolutions.de</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Thanks for the answer! :D<br class=""><br class="">But I still wonder what is the best way to get the same functionality as with pj_transform(). It might not have been the most standard conform thing but it did the job quite good and consistent. Now it seems to be that everyone needs to write a beast that analyzes the axis ordering, analyzes the coordinate format, fix all input to match requirements, do the conversion and normalize all output.<br class=""><br class="">It's a good thing for sure to have all these functions separately to use them in an optimized way if possible. But on the other hand side a high level function like pj_transform() that simply hides all the details behind a very simple and generic interface would be nice to have, too.<br class=""><br class="">Or do I miss the obvious?<br class=""><br class="">Oliver<br class=""><br class=""><br class="">Am 2019-04-02 12:44, schrieb Even Rouault:<br class=""><blockquote type="cite" class="">On mardi 2 avril 2019 10:38:45 CEST Oliver Eichler wrote:<br class=""><blockquote type="cite" class="">Hi,<br class="">I am working on the transition of QMapShack from version 4 to version 5<br class="">API. So far so good. There is only on thing that breaks. The use of EPSG<br class="">codes for projection strings.<br class="">That's what I try to do:<br class=""> // used PROJ version: 6.0.0<br class=""> // PJ * pj = proj_create(PJ_DEFAULT_CTX, "EPSG:3395"); // [1]<br class="">result for x and y is inf<br class=""> PJ * pj = proj_create(PJ_DEFAULT_CTX, "+proj=merc"); // [2]<br class="">result is expected one<br class=""> // PJ * pj = proj_create(PJ_DEFAULT_CTX, "+init=EPSG:3395") // [3]<br class="">pj is nullptr<br class=""> PJ_COORD pt = {11 * DEG_TO_RAD, 48 * DEG_TO_RAD};<br class=""> size_t s = proj_trans_generic(pj, PJ_FWD,<br class=""> &pt.xy.x, 0, 1,<br class=""> &pt.xy.y, 0, 1,<br class=""> 0,0,0,<br class=""> 0,0,0);<br class=""></blockquote>With PROJ 6, [1] instanciates a CRS object, not a coordinate transformation.<br class="">So proj_trans_generic() will return an error on it. You'd rather want to use<br class="">proj_create_crs_to_crs() with in the source CRS a geographic CRS and as target<br class="">CRS, "EPSG:3395". The coordinates passed and returned to/from<br class="">proj_trans_generic will have to follow the axis order and units of the source<br class="">and target CRS<br class="">See <a href="https://proj4.org/faq.html#why-is-the-axis-ordering-in-proj-not-consistent" class="">https://proj4.org/faq.html#why-is-the-axis-ordering-in-proj-not-consistent</a><br class="">[2] matches the PROJ 5 behaviour, and creates a coordinate operation using the<br class="">merc method. Input units and axis order is longitude, latitude in radians.<br class="">[3] is a deprecated syntax in PROJ 6. The reason is that older versions of<br class="">PROJ didn't respect the EPSG axis order in a lot of situations, and we didn't<br class="">want that to go on when using the new API.<br class="">Even<br class=""></blockquote>_______________________________________________<br class="">PROJ mailing list<br class=""><a href="mailto:PROJ@lists.osgeo.org" class="">PROJ@lists.osgeo.org</a><br class="">https://lists.osgeo.org/mailman/listinfo/proj<br class=""></div></div></blockquote></div><br class=""></div></body></html>