Class CmsGeoUtil

java.lang.Object
org.opencms.util.CmsGeoUtil

public final class CmsGeoUtil extends Object
Utility methods for processing geo coordinates.
  • Constructor Details

  • Method Details

    • parseCoordinates

      public static String parseCoordinates(String coordinates)
      Parses coordinates, either from a lat,lon pair or from the JSON generated by the location picker.
      Parameters:
      coordinates - the coordinates string
      Returns:
      the parsed coordinates
    • parseLocationPickerCoordinates

      public static String parseLocationPickerCoordinates(String jsonValue)
      Parses a location picker JSON value and returns the coordinates contained therein.
      Parameters:
      jsonValue - the JSON value as string
      Returns:
      the coordinates string or null if there are no valid location picker coordinates
    • validateCoordinates

      public static boolean validateCoordinates(String coordinates)
      Validates a coordinates string and returns the validation result.
      Parameters:
      coordinates - the coordinates string to validate
      Returns:
      whether the coordinates are valid (true) or invalid (false)
    • validateLatitude

      public static boolean validateLatitude(String latitude)
      Validates a latitude string.
      Parameters:
      latitude - the latitude string to validate
      Returns:
      whether the string is a valid latitude value (true) or not (false)
    • validateLocationPickerCoordinates

      public static boolean validateLocationPickerCoordinates(JSONObject jsonObject)
      Validates the coordinates contained in a given location picker JSON value.
      Parameters:
      jsonObject - the JSON value
      Returns:
      whether JSON contains valid coordinates (true) or not (false)
    • validateLongitude

      public static boolean validateLongitude(String longitude)
      Validates a longitude string.
      Parameters:
      longitude - the longitude string to validate
      Returns:
      whether the string is a valid longitude value (true) or not (false)
    • validateRadius

      public static boolean validateRadius(String radius)
      Validates a radius string.
      Parameters:
      radius - the radius
      Returns:
      whether a valid radius string or not
    • validateUnits

      public static boolean validateUnits(String units)
      Validates a units string.
      Parameters:
      units - the units string
      Returns:
      whether a valid units string or not