# How to calculate the UTM-Latitude-band?

I have to convert a coordinate from UTM to MGRS. I think I have the most of it covered, but I have some difficulties to calculate the correct Latitude-band. How can I decide which band the coordinate has?

-

I use:

``````zone = math.floor ((lon + 180.0) / 6) + 1
``````

Bear with me on that, and I'll check my library

So if

``````lon = -35
lat = 35
``````

Then zone will be 25, which I think is correct. Try it and let me know if it works for you.

There is also:

andrewlesley.freeserve.co.uk/gps/convertr/UTM-MGRS.html

I am sure you can get into the JS and use the code.

``````var UTMzdlChars="CDEFGHJKLMNPQRSTUVWXX";
function UTMzdl(latDeg)
{
if(-80<=latDeg&&latDeg<=84)
{
return UTMzdlChars.charAt(Math.floor((latDeg+80)/8));

}else
{
//Not normally reached
alert("No zdl: UTM is not valid for Lat "+latDeg);
return "";
}
}
``````
-
Thank you, but I already have the zone. What I need is the Latitude-band, thats a letter. It is normally told together with the zone, i.e. 32V. I need to determine the V-part. – Mnementh Oct 12 '11 at 10:36
I found this: andrewlesley.freeserve.co.uk/gps/convertr/UTM-MGRS.html and I am sure you can crack into their js and get the functions out. – Hairy Oct 12 '11 at 10:54
I "cracked" into their js (or looked the source of the site) and found: var UTMzdlChars="CDEFGHJKLMNPQRSTUVWXX"; function UTMzdl(latDeg) { if(-80<=latDeg&&latDeg<=84) return UTMzdlChars.charAt(Math.floor((latDeg+80)/8)); else { alert("No zdl: UTM is not valid for Lat "+latDeg); //Not normally reached return ""; } } Thank you! – Mnementh Oct 12 '11 at 11:10
No worries, glad to have helped, I'llput it in my answer so you cna upvote me and get me past 2000 ;) – Hairy Oct 12 '11 at 11:27
Ok, I will upvote, if the answer contains that. – Mnementh Oct 12 '11 at 13:08