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

Matthew Woehlke mwoehlke.floss at gmail.com
Tue Mar 9 10:18:33 PST 2021


On 09/03/2021 13.04, Even Rouault wrote:
> 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()

Okay, I don't understand that at all.

In PROJ 4, 4326 is "+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84". 
If I use that with proj_create, I get something usable. What's the 
difference?

p.s. How do I get that definition in PROJ 5? In PROJ 4, I could use 
pj_get_def. (See also https://stackoverflow.com/questions/66533885.)

-- 
Matthew


More information about the PROJ mailing list