Class MGRSParser
java.lang.Object
org.opensextant.extractors.xcoord.MGRSParser
- Author:
- ubaldino
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected static boolean
isValidEastingNorthing
(String ne, boolean oddLength) A hueuristic from looking at real data, real text artifacts - typos, line endings, whitespace wrapping, etc.protected static int
static org.opensextant.geodesy.MGRS[]
Given the match parse MGRS as best as can be done.
-
Constructor Details
-
MGRSParser
public MGRSParser()
-
-
Method Details
-
parseMGRS
public static org.opensextant.geodesy.MGRS[] parseMGRS(String rawtext, String txt, Map<String, String> elements) Given the match parse MGRS as best as can be done. TODO: provide level of confidence. Items that match MGRS scheme perfectly are more likely to be MGRS than those that are not perfect matches, e.g. typos, inadvertent text wrapping, whitespace etc.- Parameters:
rawtext
- the rawtexttxt
- text normalized, optionallyelements
- matched groups within regex pattern- Returns:
- array of possible MGRS interpretations.
-
isValidEastingNorthing
A hueuristic from looking at real data, real text artifacts - typos, line endings, whitespace wrapping, etc. Acceptable Northing/Eastings: dd dd dddd dddd typos: (odd number of digits; whitespace or not.) ddd dd ddddd Not valid: dd dd\nd odd digits and has line endings- Parameters:
ne
- NE string, e.g,. 56789 01234oddLength
- if len is odd- Returns:
- if easting/northing is valid
-
parseInt
- Parameters:
x
- an integer string- Returns:
- int for the string
-