Class CoordinateParseUtils

java.lang.Object
net.buildtheearth.terraminusminus.util.geo.CoordinateParseUtils

public final class CoordinateParseUtils extends Object
Utilities for assisting in the parsing of latitude and longitude strings into Decimals.

Adapted version from gbif parsers

  • Method Details

    • parseVerbatimCoordinates

      public static LatLng parseVerbatimCoordinates(String coordinates)
      Parses a String to a LatLng object, while being as flexible as possible. It can understand both decimal and DMS coordinates, and even a mix of them.

      Coordinates can use both a period ., or a comma , as the decimal separator, as long as the same is used for both the latitude and longitude.

      The coordinates can be separated by whitespaces, a semicolon ;, a slash / or a comma ,.

      If the context doesn't make it clear which of latitude or longitude comes first, latitude is assumed.

      Parameters:
      coordinates - the coordinates to parse
      Returns:
      the parsed coordinates