[PROJ] About PROJ.6: Radians or Degrees ?

Kristian Evers kreve at sdfe.dk
Tue Apr 2 03:52:25 PDT 2019


> Kristian, perhaps the documentation should explicitly mention that angular 
here must be understood as radian ?

Yes, I agree. I'll update the docs for those two functions right away.

/Kristian 

-----Oprindelig meddelelse-----
Fra: Even Rouault <even.rouault at spatialys.com> 
Sendt: 2. april 2019 12:27
Til: proj at lists.osgeo.org
Cc: Kristian Evers <kreve at sdfe.dk>; a.furieri at lqt.it
Emne: Re: [PROJ] About PROJ.6: Radians or Degrees ?

On mardi 2 avril 2019 08:21:32 CEST Kristian Evers wrote:
> I agree that the documenation of this could be better. Suggestions
> for improvements are appreciated. Pull requests that improve
> the docs are also greatly appreciated :-)
> 
> Your conclusions based on your tests are not exhaustive. Is is
> possible to have proj_create() return degrees instead of radians
> by adding a unitconvert step to a pipeline.

> Similarly,
> proj_create_crs_to_crs() can theoretically return a PJ that outputs
> radians instead of degrees (not sure if it actually is the case currently).

Without adding extra definitions in proj.db, I don't have in mind how radians 
could be expected or returned. But if you use EPSG:4807 (NTF (Paris)), you'll 
have grads for example.

Normally when using proj_create_crs_to_crs(), if your application uses 
coordinates expressed with the units (and axis order...) of the source and 
target CRS, you should'nt have to worry about doing any conversion when using 
proj_trans[_xxx]() with the PJ* returned by proj_create_crs_to_crs()

If you really need to determine the axis semantics and units, then you need to 
chain the following calls:
- proj_get_source_crs() / proj_get_target_crs()
- proj_crs_get_coordinate_system() (if it is a SingleCRS. if it is a 
CompoundCRS then you need to extra its component CRS first with 
proj_crs_get_sub_crs())
- proj_cs_get_axis_info()

Partial implementation of this (for determining axis swapping) in
https://github.com/pramsey/postgis/blob/
7ecf6839c57a838e2c8540001a3cd35b78a730db/liblwgeom/lwgeom_transform.c#L299
 
> Use proj_angular_input() [0] and proj_angular_output() [1] to determine
> what a PJ expects and returns.

Kristian, perhaps the documentation should explicitly mention that angular 
here must be understood as radian ?
If another angular unit is expected/returned, those functions will return 
false, like in 
https://github.com/OSGeo/proj.4/blob/master/test/unit/
proj_angular_io_test.cpp#L76

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the PROJ mailing list