[Proj] cs2cs - specifying UTM zone on command line

Kristian Evers kreve at sdfe.dk
Mon Oct 29 12:05:50 EST 2018



On 29 Oct 2018, at 17:30, Robb Main <rmain.mws at gmail.com<mailto:rmain.mws at gmail.com>> wrote:

When converting many lat,long coordinates to UTM, is there some way to setup cs2cs to calculate the UTM zone based on the longitude of the source cordinate system, rather than having to specify the zone on the command line?

No. You can probably do something clever in a shell script if you want, but it is not possible with any PROJ tool. See [0] for an overview of how to determine the nearest UTM zone of a coordinate.

What I'm looking for is something like: instead of this:
  cs2cs +proj=latlong +data=NAD83 +to +proj=utm +zone=10 +datum=NAD27 ./input.data
you could instead specify:
  cs2cs +proj=latlong +data=NAD83 +to +proj=utm +zone=auto +datum=NAD27 ./input.data
where 'zone=auto' might tell the algorithm to figure the zone out based on longitude of the input coordinate. This would ensure the output data would be correct, even if the input data file contains coordinates that span multiple UTM zones.

What you call correct, I regard as potentially incompatible coordinates. What you are proposing here is fundamentally breaking the promise that you are given by the cs2cs application: cs2cs transform coordinates from one coordinate reference system to another. With your proposed auto-zoned UTM the output crs would not be properly defined and your output coordinates would be incompatible in the case that they span several UTM zones. You are much better of just sticking to one zone - cs2cs will deliver numerically stable coordinates several thousands of kilometers outside the chosen zone.


[0] https://stackoverflow.com/questions/9186496/determining-utm-zone-to-convert-from-longitude-latitude

Proj mailing list
Proj at lists.maptools.org<mailto:Proj at lists.maptools.org>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/proj/attachments/20181029/cb4a0c37/attachment.htm 

More information about the Proj mailing list