I am using a framework called GeodeticUTMConverter to convert from decimal style coordinates to UTM
. However the framework only provides the Northing, Easing, Grid Zone and Hemisphere, but not the grid zone letter.
If I have the following:
northing = 5067804.5036825798
easting = 551203.31329645123
gridZone = 10
hemisphere = kUTMHemisphereNorthern
The UTM would be 10T E 551203 N 5067804
.
What is the most accurate way to calculate what the grid zone letter should be? How does the T
get calculated?
EDIT: Added method that I wrote to calculate:
+ (NSString *)UTMlatZoneForCoordinates:(CLLocationCoordinate2D)coordinate {
NSString *DigraphLetrsE = @"ABCDEFGHJKLMNPQRSTUVWXYZ";
int latz = 0;//Latitude zone: A-B S of -80, C-W -80 to +72, X 72-84, Y,Z N of 84
double latd = coordinate.latitude;
if (latd > -80 && latd < 72) {
latz = floor((latd + 80)/8)+2;
}
if (latd > 72 && latd < 84) {
latz = 21;
}
if (latd > 84){
latz = 23;
}
char letter = [DigraphLetrsE characterAtIndex:latz];
return [NSString stringWithFormat:@"%c", letter];
}