Wednesday 29 November 2017

arcgis desktop - Computing UTM Zone from lat/long point?


I am trying to convert a latlong point to UTM.


To define UTM projection, I need to calculate zone for the point.


I am trying to figure out the best way to do this.


One way to do this would be use longitude values to find the proper zone.



This would require lot of coding.


I am curious if there is a better way of doing this?



Answer



It's not that difficult, even if you handle the zones around Svalbard and Norway. Here's an example:


ZoneNumber = floor((LongTemp + 180)/6) + 1;

if( Lat >= 56.0 && Lat < 64.0 && LongTemp >= 3.0 && LongTemp < 12.0 )
ZoneNumber = 32;
endif
// Special zones for Svalbard

if( Lat >= 72.0 && Lat < 84.0 )
if ( LongTemp >= 0.0 && LongTemp < 9.0 )
ZoneNumber = 31;
elseif( LongTemp >= 9.0 && LongTemp < 21.0 )
ZoneNumber = 33;
elseif(LongTemp >= 21.0 && LongTemp < 33.0 )
ZoneNumber = 35;
elseif(LongTemp >= 33.0 && LongTemp < 42.0 )
ZoneNumber = 37;
endif

endif

Convert Latitude/Longitude to UTM (attributed to Chuck Gantz).


I haven't tried this specific code, but the algorithm looks correct.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...