[PROJ] How to map pj_latlong_from_proj to PROJ ver 7 API

Pierluigi Guasqui guasqui at actgate.com
Mon Nov 30 07:24:47 PST 2020


Hello everyone,

I've successfully compiled PROJ ver 7.2.0 on Windows 10 (build 19041.630)
and I am trying to port my code from PROJ ver 4 API to PROJ ver 7 API but I
can't find a clear matching between the old version 4 API
*pj_latlong_from_proj* routine and version 7 API code.

I tried the suggested function mapping as specified here
https://proj.org/development/migration.html#function-mapping-from-old-to-new-api,
but I am consistently getting a NULL pointer returned by the
*proj_crs_get_horizontal_datum()*. Here is my sample code:

//------------------------------------------------
#include <iostream>
#include <proj.h>

int main()
{
   PJ *proj_test = proj_create(PJ_DEFAULT_CTX, "+proj=ortho +datum=WGS84
+ellps=WGS84 +lat_0=60 +lon_0=90");
   PJ *datum = proj_crs_get_horizontal_datum(PJ_DEFAULT_CTX, proj_test);

   return 0;
}
//------------------------------------------------

*datum* is returned NULL by *proj_crs_get_horizontal_datum().*

I've also tried to use *proj_crs_get_datum()* but I still get a NULL
pointer.

Is there something wrong with my input projection?

Thanks for your help!

-- 
Pierluigi Guasqui
Software Engineer

Applied Coherent Technology Corporation (ACT)
www.actgate.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20201130/945d0ce2/attachment.html>


More information about the PROJ mailing list