[Proj] cs2cs - specifying UTM zone on command line

Robb Main rmain.mws at gmail.com
Mon Oct 29 10:34:50 PDT 2018


Thanks for the link, Kristian.

It seemed to me that the source code (specifically proj_etmerc.c:338 - 354)
looked like it would calculate the zone if one wasn't supplied (although it
also doesn't handle the 'exception' cases mentioned in your link), though I
was surprised when I could not find a way to request conversion without
specifying a zone.

As I understand your statement though, there is no way to do this with the
current implementation of PROJ tools.
On the subject of 'correctness', doesn't using a 'clever shell script' like
you suggest amount to doing what I was requesting, just doing it outside
the PROJ framework?

Regards,
Robb.

On Mon, Oct 29, 2018 at 1:07 PM Kristian Evers <kreve at sdfe.dk> wrote:

> Robb,
>
> /Kristian
>
> On 29 Oct 2018, at 17:30, Robb Main <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.
>
> /Kristian
>
> [0]
> https://stackoverflow.com/questions/9186496/determining-utm-zone-to-convert-from-longitude-latitude
>
>
> _______________________________________________
> Proj mailing list
> Proj at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/proj
>
>
> _______________________________________________
> Proj mailing list
> Proj at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/proj
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20181029/a7d6e17e/attachment.html>


More information about the Proj mailing list