/** * set lat and lon by using UTM coordinates * * @param strZone UTM-zone, e.g. 32U * @param strNorthing Northing component * @param strEasting Easting component */ public void set(String strZone, String strNorthing, String strEasting) { LatLonPoint ll = new LatLonPoint(); utm.zone_letter = strZone.charAt(strZone.length() - 1); utm.zone_number = Convert.toInt(strZone.substring(0, strZone.length() - 1)); utm.northing = (float) Common.parseDouble(strNorthing); utm.easting = (float) Common.parseDouble(strEasting); ll = utm.toLatLonPoint(); // returns null if unvalit UTM-coordinates if (ll != null) { this.utmValid = true; this.latDec = ll.getLatitude(); this.lonDec = ll.getLongitude(); } else { this.latDec = 91; this.lonDec = 361; } }
/** Checks, if the data of utm is valid, if not, utm ist calculated */ private void checkUTMvalid() { if (this.utmValid) return; this.utm = MGRSPoint.LLtoMGRS(new LatLonPoint(this.latDec, this.lonDec)); this.utmValid = true; }