[PROJ] Creating projection *not* from full init string?

Even Rouault even.rouault at spatialys.com
Tue Mar 9 10:04:14 PST 2021


Le 09/03/2021 à 18:59, Matthew Woehlke a écrit :
> I'm trying (again) to port some geodetic conversion code from the PROJ 
> 4 API.
>
> Our system uses EPSG identifiers to specify coordinate systems. (Yes, 
> yes, I'm — vaguely — aware we should also be using epochs, but frankly 
> it's a struggle to get our users to even be *aware* that there are 
> different coordinate systems, and more often than not we have to 
> assume 4326 because we don't know *anything*. Getting anything more is 
> simply not practical.)
>
> This was manageable in PROJ 4. With 6.3.2, however, I can't seem to 
> create a *usable* projection except by specifying a complete init 
> string. Calling `proj_create(0, "EPSG:4326")` gives back a non-null 
> pointer, but any calls to proj_trans fail, proj_info gives back an 
> empty definition, and proj_angular_{in,out}put all return 0.

Yes, `proj_create(0, "EPSG:4326")` creates a CRS object, not a 
coordinate operation one. proj_trans() requires a coordinate operation 
and will not work on a CRS. You need to use proj_create_crs_to_crs() to 
gt an object usabled with proj_trans()

Even

-- 
http://www.spatialys.com



More information about the PROJ mailing list