[PROJ] Behavior of proj_create_crs_to_crs() when using +proj=utm format

José Luis García Pallero jgpallero at gmail.com
Tue Oct 26 07:27:41 PDT 2021


Hello:

I'm using PROJ 8.1.1 from the Debian Sid repositories, and I'm having
troubles with proj_create_crs_to_crs() using a code that worked
without problems with PROJ 7.2.1.

My example, attached as tproj.c projects a point from (lat,lon) onto
the UTM zone 30 plane. I use the proj_trans_generic() function, but in
a first case I define the projection using the proj_create() function
with parameters "+proj=utm +lon_0=3w +ellps=GRS80". In this case all
works fine, as the UTM zone 30 is defined but its central meridian
+lon_0=3w.

But in my second example I define a transformation between CRSs using
the function proj_create_crs_to_crs(), and the parameter strings
"+proj=latlong +ellps=GRS80" and "+proj=utm +lon_0=3w +ellps=GRS80",
and the problem comes with +lon_0=3w. I need to define the parameter
string as "+proj=utm +zone=30 +ellps=GRS80", case in which all works
well. But why proj_create_crs_to_crs() works with +zone=30 and fails
with +lon_0=3w if both definitions are equivalent for the UTM, and it
works using proj_create()?

Also the error string created with proj_errno_string() is confusing,
as it returns "Unknown error (code 4096)", but at the same the string
"proj_create: Invalid zone number" is printed on screen. I think this
last message will be returned by proj_errno_string(). Also, in this
string proj_create() is referred instead of proj_create_crs_to_crs().

Attached I send the code

Thanks

-- 
*****************************************
José Luis García Pallero
jgpallero at gmail.com
(o<
/ / \
V_/_
Use Debian GNU/Linux and enjoy!
*****************************************
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tproj.c
Type: text/x-csrc
Size: 1481 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20211026/4e9f11f8/attachment.c>


More information about the PROJ mailing list