MGRS coordinate entry

Prompted by one of those infernal* posts on a Google Maps group, have finally been inspired to cobble together a MGRS -> Lat/Long conversion. It seems trvial, the UTM->MGRS conversion is quite simple, but there are a few gotchas!, so after much puzzleing over some C code from GeoTrans (and Trial&Error for good measure!), I think** have something working.

Anyway try it out here: 

Coordinate Flyto for Google Earth/Maps

also added today is a tickbox to open the result direct in Google Maps (rather than Google Earth). 

I’ll tidy it up and post the code, which is based on the PHPcoord conversion class, incase others have a use. I’ll also add it to the API – and possibly even back port it into Perl for use on the on site coordinate covertor. 

Finally possibly of interest is the realisation that the MGRS Google Earth Gridlines layer, will actully load directly in Google Maps, so:

MGRS Gridlines in Google Maps

the lines should update a few seconds after dragging/zooming. Ideally will suppress the big blue pins (which are show as numbers in GE) , but not tonight…

 

 

* in the nicest possible sence!

** I tested it by converting utm->mgrs->utm globally on a worldwide 1 degree grid – all check out with absolute precision.

Tags:

9 Responses to “MGRS coordinate entry”

  1. Munir says:

    Hi

    Nice work on MGRS and I have followed up your musings on MGRS with interest. Would it be possible for you to assist in a similar project for India Zone 1 to draw the grid lines and know the GR in India Zone 1 format.

    Regards

  2. Barry says:

    @Munir
    Do you have an links with a simple overview of the India Zone 1 grid. I know nothing about it, and only find references to technical datum transformations. looking for a wikipedia style page to get a overview to see if it should be possible.

    As an aside the MGRS layer now displays better in Google Maps, the labels use the Google Chart API to plot actual numbers rather than ugly blue pins. (but the numbers are still rather big due to limitations of Google Maps, vote here to get it changed.)

  3. Udi Oron says:

    Hi Barry!

    Inspired by your stuff and GeoTools2, I have just finished building a mapplet for Israel’s gridlines:
    http://maps.google.com/ig/add?synd=mpl&pid=mpl&moduleurl=http://www.peace-love-freedom.net/itm-mapplet/itm-mapplet.xml

    It is built upon this small js lib:
    http://code.google.com/p/js-itm/

    I believe the view based refresh is something new in Google maps, right?

    Cheers,
    Udi

  4. Barry says:

    @Udi, looks cool!

    VBR, have been in Google Maps for a while, but not really publicised (I found it ages ago, but never really did much with it)

  5. HK says:

    How ’bout that tidying in the PHP code? Finished yet? ;)

    HK

  6. HK says:

    Barry,

    I missed that one. Thanks, I will take a close look at it.

    HK

  7. Barry says:

    Ah sorry if you where meaning specifically the MGRS -> UTM cord, then see here:
    http://www.nearby.org.uk/tests/phpcoord-mgrs_dev.phps

    havnt really tidied it up, ideally the fromUTM should be a toMGRS method to fit with the rest of PHPchoord. But didnt want to touch the base classes.

  8. HK says:

    I was looking for the whole UTM -> MGRS -> UTM ++ thing, and here you’ve made it! I’m a bit into deep waters with theese type of algorithms, so it’s good to rely on someone who knows. Thanks for sharing your choord classes!

    BTW: I think the error checking routine for the precision parameters is in lack of a few dollars? ;)