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 am trying to view the Military Grid Reference System coordinates in Openlayers through the MousePosition control. Is there an easy way to accomplish this just through Javascript? I am looking at the Proj4 library and I can't seem to find support for this.

Also, why can I not find an EPSG code for this reference system? Being relatively new to geospatial web development, the answers I am finding online are just sending me in circles.

Any help would be awesome. Thanks!

share|improve this question

1 Answer 1

up vote 7 down vote accepted

you can use U.S. National Grid functions. add this code to your index page

<script src=”usng.js” mce_src=”usng.js”></script>

and then run this method:

1.LLtoUSNG(lat, lon, precision) : convert lat/lng decimal degrees to a USNG string

example:

alert(LLtoUSNG(lat, long, 5));

example result:

Five digits:  1 meter precision    eg. "18S UJ 23480 06470"

2.USNGtoLL(usng_string,latlng) : convert a USNG string to lat/lng decimal degrees

example input:

NNCCCNNNNNNNNNN
NNC CC NNNNNNNNNN
NNC CC NNNNN NNNNN

3.LLtoUTM(lat,lon, utmcoords): Converts lat/long to UTM coords.

there are some informations in js...

As for the other question, mgrs system is not a coordinate tuple because of having four parameters. in normal case coordinate tuples consist of two parameter as lat and lon...

i hope it helps you...

share|improve this answer
    
wow thanks! Go that working instantly! –  Kyle May 17 '12 at 17:08
1  
Bastion of knowledge wikipedia says "It resembles the Military Grid Reference System (MGRS). When the WGS84 datum or NAD83 datum is used, USNG and MGRS coordinates are practically identical." The question, I think, is how are they not precisely identical? Possibly also worth pointing out that the lib linked in this answer is GPL'd. –  ruffin Sep 13 '12 at 19:17
1  
Looks like you can get that answer here. For NAD 83 or WGS 94, they produce "equivalent" values. In NAD 27, there's a difference, apparently. –  ruffin Sep 14 '12 at 12:35

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.