grass icon indicating copy to clipboard operation
grass copied to clipboard

libgproj: Use SRID for PJ object creation when possible

Open HuidaeCho opened this issue 3 years ago • 3 comments

This PR tries to address #2257 by using SRID, not GRASS key-value pairs, for creating an PJ object. Here is a related Q&A.

HuidaeCho avatar May 23 '22 06:05 HuidaeCho

@metzm Do we ever hit this PROJ error when pj is already not NULL? https://github.com/OSGeo/grass/blob/830f31d215038c1a67112aa350619f652e04e70b/lib/proj/get_proj.c#L275-L278

HuidaeCho avatar May 30 '22 18:05 HuidaeCho

@metzm Do we ever hit this PROJ error when pj is already not NULL?

https://github.com/OSGeo/grass/blob/830f31d215038c1a67112aa350619f652e04e70b/lib/proj/get_proj.c#L275-L278

I think we can remove this check.

https://proj.org/development/reference/functions.html#c.proj_create_argv

If creation of the transformation object fails, the function returns 0 and the PROJ error number is updated.

HuidaeCho avatar Jun 01 '22 04:06 HuidaeCho

Apparently proj_errno(pj) can still return an error code, if pj is not NULL. At least this is used in various places in PROJ itself.

metzm avatar Jul 01 '22 16:07 metzm