Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

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 ""; 
     } 
} 
share|improve this answer
1  
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
1  
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
2  
Ok, I will upvote, if the answer contains that. –  Mnementh Oct 12 '11 at 13:08
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.