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!

1 Answer 1


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


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:


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...

  • 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, 2012 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, 2012 at 12:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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