Class MGRSParser

java.lang.Object
org.opensextant.extractors.xcoord.MGRSParser

public class MGRSParser extends Object
Author:
ubaldino
  • 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 rawtext
      txt - text normalized, optionally
      elements - matched groups within regex pattern
      Returns:
      array of possible MGRS interpretations.
    • isValidEastingNorthing

      protected static boolean isValidEastingNorthing(String ne, boolean oddLength)
      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 01234
      oddLength - if len is odd
      Returns:
      if easting/northing is valid
    • parseInt

      protected static int parseInt(String x)
      Parameters:
      x - an integer string
      Returns:
      int for the string