Package org.codice.ddf.libs.geo.util
Class GeospatialUtil
java.lang.Object
org.codice.ddf.libs.geo.util.GeospatialUtil
Convenience methods for performing geospatial conversions.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic org.locationtech.jts.geom.GeometrycreateCirclePolygon(double lat, double lon, double radius, int maxVertices, double distanceTolerance) Create a circular polygon from a lat, lon, radius, vertices, and distanceTolerance.static DoubleParses Latitude in the DMS format of DD:MM:SS.S N/Sstatic DoubleParses Longitude in the DMS format of [D]DD:MM:SS.S E/Wstatic org.locationtech.jts.geom.GeometrytransformToEPSG4326LonLatFormat(org.locationtech.jts.geom.Geometry geometry, String sourceCrsName) Transform a geometry to EPSG:4326 format with lon/lat coordinate ordering.static org.locationtech.jts.geom.GeometrytransformToEPSG4326LonLatFormat(org.locationtech.jts.geom.Geometry geometry, org.geotools.api.referencing.crs.CoordinateReferenceSystem sourceCrs) Transform a geometry to EPSG:4326 format with lon/lat coordinate ordering.
-
Field Details
-
EPSG_4326
- See Also:
-
EPSG_4326_URN
- See Also:
-
LAT_LON_ORDER
- See Also:
-
LON_LAT_ORDER
- See Also:
-
-
Method Details
-
parseDMSLatitudeWithDecimalSeconds
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
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 transformsourceCrsName- - 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 transformsourceCrs- - 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 degreeslon- - longitude in EPSG:4326 decimal degrees- Returns:
- radius - distance from the center point in meters
-