| java.lang.Object org.geotools.geometry.jts.JTS
JTS | final public class JTS (Code) | | JTS Geometry utility methods, bringing Geotools to JTS.
Offers geotools based services such as reprojection.
Responsibilities:
- transformation
- coordinate sequence editing
- common coordinate sequence implementations for specific uses
since: 2.2 version: $Id: JTS.java 26970 2007-09-14 14:05:43Z aaime $ author: Jody Garnett author: Martin Desruisseaux author: Simone Giannecchini |
Method Summary | |
public static void | checkCoordinatesRange(Geometry geom, CoordinateReferenceSystem crs) Checks a Geometry coordinates are within the area of validity of the
specified reference system. | public static void | copy(Coordinate point, double[] ordinates) Copies the ordinates values from the specified JTS coordinates to the specified array. | public static Envelope2D | getEnvelope2D(Envelope envelope, CoordinateReferenceSystem crs) Converts a JTS 2D envelope in an
Envelope2D for interoperability with the
referencing package.
If the provided envelope is a
ReferencedEnvelope we check
that the provided CRS and the implicit CRS are similar.
Parameters: envelope - The JTS envelope to convert. Parameters: crs - The coordinate reference system for the specified envelope. | public static synchronized double | orthodromicDistance(Coordinate p1, Coordinate p2, CoordinateReferenceSystem crs) Computes the orthodromic distance between two points. | public static Geometry | shapeToGeometry(Shape shape, GeometryFactory factory) Converts an arbitrary Java2D shape into a JTS geometry. | public static Envelope | toGeographic(Envelope envelope, CoordinateReferenceSystem crs) Transforms the envelope from its current crs to WGS84 coordinate reference system.
If the specified envelope is already in WGS84, then it is returned unchanged.
Parameters: envelope - The envelope to transform. Parameters: crs - The CRS the envelope is currently in. | public static Polygon | toGeometry(Envelope e) Converts an envelope to a polygon.
The resulting polygon contains an outer ring with verticies:
(x1,y1),(x2,y1),(x2,y2),(x1,y2),(x1,y1)
Parameters: envelope - The original envelope. | public static Envelope | transform(Envelope envelope, MathTransform transform) Transforms the envelope using the specified math transform.
Note that this method can not handle the case where the envelope contains the North or
South pole, or when it cross the ±180� longitude, because
do not carry suffisient informations. | public static Envelope | transform(Envelope sourceEnvelope, Envelope targetEnvelope, MathTransform transform, int npoints) Transforms the densified envelope using the specified math transform.
The envelope is densified (extra points put around the outside edge)
to provide a better new envelope for high deformed situations.
If an optional target envelope is provided, this envelope will be
with the transformation result. | public static Geometry | transform(Geometry geom, MathTransform transform) Transforms the geometry using the default transformer.
Parameters: geom - The geom to transform Parameters: transform - the transform to use during the transformation. | public static Coordinate | transform(Coordinate source, Coordinate dest, MathTransform transform) Transforms the coordinate using the provided math transform.
Parameters: source - the source coordinate that will be transformed Parameters: dest - the coordinate that will be set. | public static void | xform(MathTransform transform, double[] src, double[] dest) Like a transform but eXtreme!
Transforms an array of coordinates using the provided math transform.
Each coordinate is transformed separately. |
checkCoordinatesRange | public static void checkCoordinatesRange(Geometry geom, CoordinateReferenceSystem crs) throws PointOutsideEnvelopeException(Code) | | Checks a Geometry coordinates are within the area of validity of the
specified reference system. If a coordinate falls outside the area of
validity a
PointOutsideEnvelopeException is thrown
Parameters: geom - the geometry to check Parameters: the - crs that defines the are of validity (must not be null) throws: PointOutsideEnvelopeException - since: 2.4 |
copy | public static void copy(Coordinate point, double[] ordinates)(Code) | | Copies the ordinates values from the specified JTS coordinates to the specified array. The
destination array can have any length. Only the relevant field of the source coordinate will
be copied. If the array length is greater than 3, then all extra dimensions will be set to
Double.NaN NaN .
Parameters: point - The source coordinate. Parameters: ordinates - The destination array. |
getEnvelope2D | public static Envelope2D getEnvelope2D(Envelope envelope, CoordinateReferenceSystem crs) throws MismatchedDimensionException(Code) | | Converts a JTS 2D envelope in an
Envelope2D for interoperability with the
referencing package.
If the provided envelope is a
ReferencedEnvelope we check
that the provided CRS and the implicit CRS are similar.
Parameters: envelope - The JTS envelope to convert. Parameters: crs - The coordinate reference system for the specified envelope. The GeoAPI envelope. throws: MismatchedDimensionException - if a two-dimensional envelope can't be createdfrom an envelope with the specified CRS. since: 2.3 |
orthodromicDistance | public static synchronized double orthodromicDistance(Coordinate p1, Coordinate p2, CoordinateReferenceSystem crs) throws TransformException(Code) | | Computes the orthodromic distance between two points. This method:
- Transforms both points to geographic coordinates
(latitude,longitude).
- Computes the orthodromic distance between the two points using ellipsoidal
calculations.
The real work is performed by
GeodeticCalculator . This convenience method simply
manages a pool of pre-defined geodetic calculators for the given coordinate reference system
in order to avoid repetitive object creation. If a large amount of orthodromic distances
need to be computed, direct use of
GeodeticCalculator provides better performance
than this convenience method.
Parameters: p1 - First point Parameters: p2 - Second point Parameters: crs - Reference system the two points are in. Orthodromic distance between the two points, in meters. throws: TransformException - if the coordinates can't be transformed from the specifiedCRS to a . |
shapeToGeometry | public static Geometry shapeToGeometry(Shape shape, GeometryFactory factory)(Code) | | Converts an arbitrary Java2D shape into a JTS geometry. The created JTS geometry
may be any of
LineString ,
LinearRing or
MultiLineString .
Parameters: shape - The Java2D shape to create. Parameters: factory - The JTS factory to use for creating geometry. The JTS geometry. |
toGeographic | public static Envelope toGeographic(Envelope envelope, CoordinateReferenceSystem crs) throws TransformException(Code) | | Transforms the envelope from its current crs to WGS84 coordinate reference system.
If the specified envelope is already in WGS84, then it is returned unchanged.
Parameters: envelope - The envelope to transform. Parameters: crs - The CRS the envelope is currently in. The envelope transformed to be in WGS84 CRS. throws: TransformException - If at least one coordinate can't be transformed. |
toGeometry | public static Polygon toGeometry(Envelope e)(Code) | | Converts an envelope to a polygon.
The resulting polygon contains an outer ring with verticies:
(x1,y1),(x2,y1),(x2,y2),(x1,y2),(x1,y1)
Parameters: envelope - The original envelope. The envelope as a polygon. since: 2.4 |
transform | public static Envelope transform(Envelope envelope, MathTransform transform) throws TransformException(Code) | | Transforms the envelope using the specified math transform.
Note that this method can not handle the case where the envelope contains the North or
South pole, or when it cross the ±180� longitude, because
do not carry suffisient informations. For a more robust envelope
transformation, use
ReferencedEnvelope.transform(CoordinateReferenceSystemboolean) instead.
Parameters: envelope - The envelope to transform. Parameters: transform - The transform to use. The transformed Envelope throws: TransformException - if at least one coordinate can't be transformed. |
transform | public static Envelope transform(Envelope sourceEnvelope, Envelope targetEnvelope, MathTransform transform, int npoints) throws TransformException(Code) | | Transforms the densified envelope using the specified math transform.
The envelope is densified (extra points put around the outside edge)
to provide a better new envelope for high deformed situations.
If an optional target envelope is provided, this envelope will be
with the transformation result. It will
not be
before the expansion.
Note that this method can not handle the case where the envelope contains the North or
South pole, or when it cross the ±180� longitude, because
do not carry suffisient informations. For a more robust envelope
transformation, use
ReferencedEnvelope.transform(CoordinateReferenceSystembooleanint) instead.
Parameters: sourceEnvelope - The envelope to transform. Parameters: targetEnvelope - An envelope to expand with the transformation result, or null for returning an new envelope. Parameters: transform - The transform to use. Parameters: npoints - Densification of each side of the rectange. targetEnvelope if it was non-null, or a new envelope otherwise.In all case, the returned envelope fully contains the transformed envelope. throws: TransformException - if a coordinate can't be transformed. |
transform | public static Geometry transform(Geometry geom, MathTransform transform) throws MismatchedDimensionException, TransformException(Code) | | Transforms the geometry using the default transformer.
Parameters: geom - The geom to transform Parameters: transform - the transform to use during the transformation. the transformed geometry. It will be a new geometry. throws: MismatchedDimensionException - if the geometry doesn't have the expected dimensionfor the specified transform. throws: TransformException - if a point can't be transformed. |
transform | public static Coordinate transform(Coordinate source, Coordinate dest, MathTransform transform) throws TransformException(Code) | | Transforms the coordinate using the provided math transform.
Parameters: source - the source coordinate that will be transformed Parameters: dest - the coordinate that will be set. May be null or the source coordinate(or new coordinate of course). the destination coordinate if not null or a new Coordinate. throws: TransformException - if the coordinate can't be transformed. |
xform | public static void xform(MathTransform transform, double[] src, double[] dest) throws TransformException(Code) | | Like a transform but eXtreme!
Transforms an array of coordinates using the provided math transform.
Each coordinate is transformed separately. In case of a transform exception then
the new value of the coordinate is the last coordinate correctly transformed.
Parameters: transform - The math transform to apply. Parameters: src - The source coordinates. Parameters: dest - The destination array for transformed coordinates. throws: TransformException - if this method failed to transform any of the points. |
|
|