Package org.opengis.cite.geomatics
Class GeodesyUtils
java.lang.Object
org.opengis.cite.geomatics.GeodesyUtils
Provides utility methods for using coordinate reference systems and performing
coordinate transformations.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic DirectPosition
calculateDestination
(Position startingPos, double azimuth, double distance) Determines the destination position given the azimuth and distance from some starting position.static String
convertSRSNameToURN
(String srsName) Converts an srsName identifier to the corresponding URN value if it is an 'http' URI.static String
getAbbreviatedCRSIdentifier
(String srsName) Returns an abbreviated identifier for the given CRS reference.static String
Returns a well-known identifier (URI) for the given coordinate reference system using the 'urn' scheme (e.g.static org.apache.sis.geometry.ImmutableEnvelope
getDomainOfValidity
(String crsRef) Returns an immutable envelope representing the valid geographic extent of the CRS identified by the given URI reference.static void
removeConsecutiveDuplicates
(List<Coordinate> coordList, double tolerancePPM) Checks a coordinate list for consecutive duplicate positions and removes them.static Coordinate[]
transformRingToRightHandedCS
(org.geotoolkit.gml.xml.AbstractRing gmlRing) Transforms the given GML ring to a right-handed coordinate system (if it does not already use one) and returns the resulting coordinate sequence.static Coordinate[]
transformRingToRightHandedCSKeepAllCoords
(org.geotoolkit.gml.xml.AbstractRing gmlRing) Transforms the given GML ring to a right-handed coordinate system (if it does not already use one) and returns the resulting coordinate sequence.
-
Field Details
-
EPSG_4326
OGC identifier for WGS 84 (geographic 2D)- See Also:
-
OGC_CRS84
OGC identifier for WGS 84 (longitude-latitude)- See Also:
-
-
Constructor Details
-
GeodesyUtils
public GeodesyUtils()
-
-
Method Details
-
getDomainOfValidity
public static org.apache.sis.geometry.ImmutableEnvelope getDomainOfValidity(String crsRef) throws FactoryException Returns an immutable envelope representing the valid geographic extent of the CRS identified by the given URI reference.- Parameters:
crsRef
- An absolute URI that identifies a CRS definition.- Returns:
- An ImmutableEnvelope object.
- Throws:
FactoryException
- if the CRS reference cannot be resolved to a known definition.
-
getCRSIdentifier
Returns a well-known identifier (URI) for the given coordinate reference system using the 'urn' scheme (e.g. "urn:ogc:def:crs:EPSG::4326").- Parameters:
crs
- ACoordinateReferenceSystem
object.- Returns:
- A String representing a URN value in the 'ogc' namespace; if no identifier can be constructed an empty String is returned.
- See Also:
-
- "OGC 09-048r3: Name type specification - definitions - part 1 - basic name"
-
calculateDestination
public static DirectPosition calculateDestination(Position startingPos, double azimuth, double distance) Determines the destination position given the azimuth and distance from some starting position.- Parameters:
startingPos
- The starting position.azimuth
- The horizontal angle measured clockwise from a meridian.distance
- The great-circle (orthodromic) distance in the same units as the ellipsoid axis (e.g. meters for EPSG 4326).- Returns:
- A DirectPosition representing the destination position (in the same CRS as the starting position).
-
transformRingToRightHandedCS
public static Coordinate[] transformRingToRightHandedCS(org.geotoolkit.gml.xml.AbstractRing gmlRing) Transforms the given GML ring to a right-handed coordinate system (if it does not already use one) and returns the resulting coordinate sequence. Many computational geometry algorithms assume right-handed coordinates. In some cases this can be achieved simply by changing the axis order; for example, from (lat,lon) to (lon,lat).- Parameters:
gmlRing
- A representation of a GML ring (simple closed curve).- Returns:
- A Coordinate[] array, or
null
if the original CRS could not be identified.
-
transformRingToRightHandedCSKeepAllCoords
public static Coordinate[] transformRingToRightHandedCSKeepAllCoords(org.geotoolkit.gml.xml.AbstractRing gmlRing) Transforms the given GML ring to a right-handed coordinate system (if it does not already use one) and returns the resulting coordinate sequence. Many computational geometry algorithms assume right-handed coordinates. In some cases this can be achieved simply by changing the axis order; for example, from (lat,lon) to (lon,lat).- Parameters:
gmlRing
- A representation of a GML ring (simple closed curve).- Returns:
- A Coordinate[] array, or
null
if the original CRS could not be identified.
-
getAbbreviatedCRSIdentifier
Returns an abbreviated identifier for the given CRS reference. The result contains the code space (authority) and code value extracted from the URI reference.- Parameters:
srsName
- An absolute URI ('http' or 'urn' scheme) that identifies a CRS in accord with OGC 09-048r3.- Returns:
- A String of the form "
authority:code
". - See Also:
-
convertSRSNameToURN
Converts an srsName identifier to the corresponding URN value if it is an 'http' URI. The Geotk 3.x library does not recognize CRS identifiers based on the 'http' schreme.- Parameters:
srsName
- An absolute URI that identifies a CRS in accord with OGC 09-048r3.- Returns:
- A URN-based identifier (the given value is unchanged if it is not an 'http' URI).
- See Also:
-
removeConsecutiveDuplicates
Checks a coordinate list for consecutive duplicate positions and removes them. That is, P(n+1) is removed if it represents the same location as P(n) within the specified tolerance, unless it is the last point in the list in which case P(n) is removed instead (the last point may coincide with the first in order to form a cycle). The third dimension is ignored.- Parameters:
coordList
- A list of Coordinate objects.tolerancePPM
- The tolerance for comparing coordinates, in parts per million (ppm).
-