Package org.opencms.util
Class CmsGeoUtil
java.lang.Object
org.opencms.util.CmsGeoUtil
Utility methods for processing geo coordinates.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
parseCoordinates
(String coordinates) Parses coordinates, either from a lat,lon pair or from the JSON generated by the location picker.static String
parseLocationPickerCoordinates
(String jsonValue) Parses a location picker JSON value and returns the coordinates contained therein.static boolean
validateCoordinates
(String coordinates) Validates a coordinates string and returns the validation result.static boolean
validateLatitude
(String latitude) Validates a latitude string.static boolean
validateLocationPickerCoordinates
(JSONObject jsonObject) Validates the coordinates contained in a given location picker JSON value.static boolean
validateLongitude
(String longitude) Validates a longitude string.static boolean
validateRadius
(String radius) Validates a radius string.static boolean
validateUnits
(String units) Validates a units string.
-
Constructor Details
-
CmsGeoUtil
public CmsGeoUtil()
-
-
Method Details
-
parseCoordinates
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
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
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
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
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
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
Validates a radius string.- Parameters:
radius
- the radius- Returns:
- whether a valid radius string or not
-
validateUnits
Validates a units string.- Parameters:
units
- the units string- Returns:
- whether a valid units string or not
-