For my App I need compact code for converting between LatLon (WGS84) and MGRS.
JCoord.jar: Looks great, but the version 1.1 jar is 0.5Mb in size. That is doubles my App for only perfoming a 2-way conversion of coordinates.
Openmap: Isolating just the MGRSPoint.java (https://code.google.com/p/openmap/source/browse/src/openmap/com/bbn/openmap/proj/coords/MGRSPoint.java) from the rest is not easy.
GeographicLib: This seems a good solution, but I could not find a Java source file. Is it available for usage?
Nasa: The Nasa code looks great, see http://worldwind31.arc.nasa.gov/svn/trunk/WorldWind/src/gov/nasa/worldwind/geom/coords/MGRSCoordConverter.java. Isolating just the MGRS conversion code was not easy.
GDAL: Was implemented in another programming language.
IBM (via j-coordconvert.zip): Is complact, suits well for the UTM conversion, but the MGRS conversion is described to be errorneous. Alas.
Is there a good (compact) Java source for converting between LatLon/wgs84 and MGRS?
Finally found a sufficient good answer. Berico, thank you!
https://github.com/Berico-Technologies/Geo-Coordinate-Conversion-Java
This source code isolates the NASA Java source code and adds 1 nice utility class.
Examples:
double lat = 52.202050;
double lon = 6.102050;
System.out.println( "To MGRS is " + Coordinates.mgrsFromLatLon( lat, lon));
And the other way around:
String mgrs = "31UCU 59248 14149";
double[] latlon = Coordinates.latLonFromMgrs( mgrs);