<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Robb,<br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 29 Oct 2018, at 18:34, Robb Main <<a href="mailto:rmain.mws@gmail.com" class="">rmain.mws@gmail.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">Thanks for the link, Kristian.
<div class=""><br class="">
</div>
<div class="">
<div class="">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.</div>
<div class=""><br class="">
</div>
</div>
</div>
</div>
</blockquote>
<div><br class="">
</div>
<div>In that part of the code it tries to determine the zone from the central meridian set with +lon_0. If neither +zone or +lon_0 is set PROJ defaults to zone 30 (based on the default value of +lon_0 which is 0 when not specified).</div>
<div><br class="">
</div>
<blockquote type="cite" class="">
<div class="">
<div dir="ltr" class="">
<div class="">
<div class="">As I understand your statement though, there is no way to do this with the current implementation of PROJ tools. </div>
</div>
</div>
</div>
</blockquote>
<div><br class="">
</div>
<div>Correct. </div>
<br class="">
<blockquote type="cite" class="">
<div class="">
<div dir="ltr" class="">
<div class="">
<div class="">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?</div>
</div>
</div>
</div>
</blockquote>
<div><br class="">
</div>
Yes. I am not saying that it is a smart thing to do, but if you really want to, there’s a way to do it.</div>
<div><br class="">
</div>
<div>/Kristian<br class="">
<br class="">
<blockquote type="cite" class="">
<div class="">
<div dir="ltr" class="">
<div class="">
<div class="">
<div class="">Regards,</div>
</div>
<div class="">Robb.</div>
</div>
</div>
<br class="">
<div class="gmail_quote">
<div dir="ltr" class="">On Mon, Oct 29, 2018 at 1:07 PM Kristian Evers <<a href="mailto:kreve@sdfe.dk" class="">kreve@sdfe.dk</a>> wrote:<br class="">
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word;line-break:after-white-space" class="">Robb,
<div class=""><br class="">
</div>
<div class="">/Kristian<br class="">
<div class=""><br class="">
</div>
<div class="">
<div class="">
<blockquote type="cite" class="">
<div class="">On 29 Oct 2018, at 17:30, Robb Main <<a href="mailto:rmain.mws@gmail.com" target="_blank" class="">rmain.mws@gmail.com</a>> wrote:</div>
<br class="m_6088843805229460402Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">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?</div>
</div>
</blockquote>
<div class=""><br class="">
</div>
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.</div>
<div class=""><br class="">
<blockquote type="cite" class="">
<div class="">
<div dir="ltr" class="">
<div class=""><br class="">
</div>
<div class="">What I'm looking for is something like: instead of this:</div>
<div class="">  cs2cs +proj=latlong +data=NAD83 +to +proj=utm +zone=10 +datum=NAD27 ./input.data</div>
<div class="">you could instead specify:</div>
<div class="">
<div class="">  cs2cs +proj=latlong +data=NAD83 +to +proj=utm +zone=auto +datum=NAD27 ./input.data</div>
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.</div>
</div>
</div>
</blockquote>
<div class=""><br class="">
</div>
<div class="">
<div class="">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.</div>
<div class=""><br class="">
</div>
<div class="">/Kristian</div>
<div class=""><br class="">
</div>
<div class="">[0] <a href="https://stackoverflow.com/questions/9186496/determining-utm-zone-to-convert-from-longitude-latitude" target="_blank" class="">https://stackoverflow.com/questions/9186496/determining-utm-zone-to-convert-from-longitude-latitude</a> </div>
</div>
<br class="">
<blockquote type="cite" class="">
<div class="">_______________________________________________<br class="">
Proj mailing list<br class="">
<a href="mailto:Proj@lists.maptools.org" target="_blank" class="">Proj@lists.maptools.org</a><br class="">
<a href="http://lists.maptools.org/mailman/listinfo/proj" target="_blank" class="">http://lists.maptools.org/mailman/listinfo/proj</a></div>
</blockquote>
</div>
<br class="">
</div>
</div>
</div>
_______________________________________________<br class="">
Proj mailing list<br class="">
<a href="mailto:Proj@lists.maptools.org" target="_blank" class="">Proj@lists.maptools.org</a><br class="">
<a href="http://lists.maptools.org/mailman/listinfo/proj" rel="noreferrer" target="_blank" class="">http://lists.maptools.org/mailman/listinfo/proj</a></blockquote>
</div>
_______________________________________________<br class="">
Proj mailing list<br class="">
<a href="mailto:Proj@lists.maptools.org" class="">Proj@lists.maptools.org</a><br class="">
http://lists.maptools.org/mailman/listinfo/proj</div>
</blockquote>
</div>
<br class="">
</body>
</html>