Class GeospatialUtil

java.lang.Object
org.codice.ddf.libs.geo.util.GeospatialUtil

public class GeospatialUtil extends Object
Convenience methods for performing geospatial conversions.
  • Field Details

  • Method Details

    • parseDMSLatitudeWithDecimalSeconds

      public static Double parseDMSLatitudeWithDecimalSeconds(String dmsLat) throws GeoFormatException
      Parses Latitude in the DMS format of DD:MM:SS.S N/S
      Parameters:
      dmsLat - Degrees Minutes Seconds formatted latitude.
      Returns:
      Latitude in decimal degrees
      Throws:
      GeoFormatException
    • parseDMSLongitudeWithDecimalSeconds

      public static Double parseDMSLongitudeWithDecimalSeconds(String dmsLon) throws GeoFormatException
      Parses Longitude in the DMS format of [D]DD:MM:SS.S E/W
      Parameters:
      dmsLon - Degrees Minutes Seconds formatted longitude.
      Returns:
      Longitude in decimal degrees.
      Throws:
      GeoFormatException
    • transformToEPSG4326LonLatFormat

      public static org.locationtech.jts.geom.Geometry transformToEPSG4326LonLatFormat(org.locationtech.jts.geom.Geometry geometry, String sourceCrsName) throws GeoFormatException
      Transform a geometry to EPSG:4326 format with lon/lat coordinate ordering. NOTE: This method will perform the transform swapping coordinates even if the sourceCrsName is EPSG:4326
      Parameters:
      geometry - - Geometry to transform
      sourceCrsName - - Source geometry's coordinate reference system
      Returns:
      Geometry - Transformed geometry into EPSG:4326 lon/lat coordinate system
      Throws:
      GeoFormatException
    • transformToEPSG4326LonLatFormat

      public static org.locationtech.jts.geom.Geometry transformToEPSG4326LonLatFormat(org.locationtech.jts.geom.Geometry geometry, org.geotools.api.referencing.crs.CoordinateReferenceSystem sourceCrs) throws GeoFormatException
      Transform a geometry to EPSG:4326 format with lon/lat coordinate ordering. NOTE: This method will NOT perform the transform swapping coordinates even if the sourceCrsName is EPSG:4326.
      Parameters:
      geometry - - Geometry to transform
      sourceCrs - - Source geometry's coordinate reference system
      Returns:
      Geometry - Transformed geometry into EPSG:4326 lon/lat coordinate system
      Throws:
      GeoFormatException
    • createCirclePolygon

      public static org.locationtech.jts.geom.Geometry createCirclePolygon(double lat, double lon, double radius, int maxVertices, double distanceTolerance)
      Create a circular polygon from a lat, lon, radius, vertices, and distanceTolerance.
      Parameters:
      lat - - latitude in EPSG:4326 decimal degrees
      lon - - longitude in EPSG:4326 decimal degrees
      Returns:
      radius - distance from the center point in meters