usng.js icon indicating copy to clipboard operation
usng.js copied to clipboard

Add mgrs conversions

Open mkellogg91 opened this issue 3 years ago • 5 comments

in my use of usng.js while I could convert Lat Lon to MGRS I could not find a way to convert MGRS to Lat Lon.

I wrote a function to convert MGRS to USNG and then used USNG's existing USNGtoLL function for converting from MGRS to Lat Lon in the MGRStoLL function.

an example is: converter.MGRStoLL("4QFJ2128465763")

mkellogg91 avatar Aug 04 '21 20:08 mkellogg91

hey @vinamartin, didn't see any guidelines on how to submit a PR, and I'm not sure if anyone has seen this request

mkellogg91 avatar Aug 06 '21 14:08 mkellogg91

@mkellogg91 Hi there! I'll tag a few folks to look at this, I'm not super active on this project at this time but maybe @jaymcnallie, @jlcsmith, or @pklinef could give this a review?

vinamartin avatar Aug 06 '21 16:08 vinamartin

@mkellogg91 I think these changes would only work if the datum being used was WGS84 for USNG. But currently I think we only support NAD27 and NAD83 for USNG.

https://github.com/codice/usng.js/blob/master/src/usng.ts#L187-L200

https://www.maptools.com/tutorials/mgrs_usng_diffs http://semonitoringguide.sepif.org/sampling-grids/military-grid-reference-system

pklinef avatar Aug 16 '21 17:08 pklinef

@pklinef I'm using currently using USNG with the WGS84 datum in my use case and it's working fine. I get what you are saying though if another datum was being used for my conversion functions. Not sure if this change could still be adopted if it was somehow earmarked for only WGS84. All my users care about is WGS84

mkellogg91 avatar Aug 27 '21 15:08 mkellogg91

@mkellogg91 An alternative would be to add the ability to set the USNG options to a WGS84 datum in addition to the currently supported NAD27 and NAD83 standard datums. Then we could allow that conversion as you have it now only if the WGS84 datum is configured. That would help protect someone using one of the two standard USNG datums from accidentally converting and getting an incorrect conversion.

pklinef avatar Aug 30 '21 18:08 pklinef