lcatania

Converting MGRS to Geographic Coordinates

Discussion created by lcatania on Mar 6, 2013
I have a text box where the user can enter in MGRS coordinates.  After entering a user clicks on the validate button.  If the MGRS is not valid the app completely hangs up and eventually crashes without any stack trace.  I was trying to have it validate as the user was typing, but the app hung and I would hear clicking noises every couple of seconds as if it was processing touch events. 

I also have if the user types in the lat and lon in text boxes, it will auto populate the MGRS text box on the fly as the user types.  I want the same if the user types in the MGRS box.  I want it to validate on the fly.  After this, the user can touch a button and zoom to those coordinates.  My snip of code is simply:

mapPoint = SpatialReference.create(applicationState.getMapView().getSpatialReference().getID()).fromMilitaryGrid(mgrsLocationString, MgrsConversionMode.mgrsAutomatic);

Outcomes