[PROJ] coordinate order confusion

Greg Troxel gdt at lexort.com
Thu Apr 23 13:03:43 PDT 2020


I'm trying to actually use proj to calculate something, as part of being
sure about NAD83/WGS84 for imagery available for openstreetmap in
Massachusetts.  So while I've used proj long ago, mostly I've been
keeping up with packaging lately and am thus kind of like a new user.

I read the cs2cs man page (proj 6.3.1), and see

       -r     This options reverses the order of the expected input from
              longitude-latitude or x-y to latitude-longitude or y-x.

       -s     This options reverses the order of the output from x-y or
              longitude-latitude to y-x or latitude-longitude.

I want to use "lat lon" (with lon being roughly -71 for 71W), so I gave
-r and -s.  However, when I do that, and then use invgeod on the input
and transformed coordinates, I get displacements that seem unreasonably
large.  Without, they are ok.

On the  third time through the man page, I see that the coordinate order
depends on the CRS, and apparently both that I am using are "lat lon"

So I think the -r/-s descriptions need to be changed, because they state
outright that without them the order is "longtitude latitude".  It seems
really it is

       -r     This options reverses the order of the first two expected
              inputs from that specified by the CRS to the opposite
              order.  The third coordinate, typically height, remains
              third.
	
which is quite different, at least as I see it.



Details of what I did:

With -r -s I get an unreasonable displacement, which is a clue that I am
operating not in the US:

  $ cs2cs -d 9 -r -s EPSG:6319 +to EPSG:7665 << EOF
  42.0 -71.0 40.0
  EOF
  42.000080905	-70.999991071 39.664754187

  invgeod +ellps=GRS80 << EOF
  42 -71	42.000080905	-70.999991071
  EOF
  4d42'21.847"	-175d17'38.132"	9.017

Without -r -s, it all makes sense:

  $ cs2cs -d 9 EPSG:6319 +to EPSG:7665 << EOF
  42.0 -71.0 40.0
  EOF
  42.000008648	-71.000000518 38.760790157

  I get a displacement that checks with my a priori expectation of about a meter.

  invgeod +ellps=GRS80 << EOF
  42 -71	42.000008648	-71.000000518
  EOF
  -2d33'29.527"	177d26'30.472"	0.962


More information about the PROJ mailing list