GeometryCollections would be useful,
GeometryCollections are not supported as arguments to binary predicates or the
relate method.
Point,
LineString, or
Polygon will be returned if the result contains a single element; otherwise, a
MultiPoint,
MultiLineString, or
MultiPolygon will be returned. If the result is heterogeneous a
GeometryCollection will be returned.
Because it is not clear at this time what semantics for set-theoretic methods involving GeometryCollections would be useful, GeometryCollections are not supported as arguments to the set-theoretic methods.
Geometry.
The SFS does not specify an unambiguous representation of a given point set returned from a spatial analysis method. One goal of JTS is to make this specification precise and unambiguous. JTS uses a canonical form for Geometrys returned from overlay methods. The canonical form is a Geometry which is simple and noded:
isSimple. LineStrings. It means that all intersection points on LineStrings will be present as endpoints of LineStrings in the result. Geometry s. These new points arise from intersections between line segments in the edges of the input
Geometrys. In the general case it is not possible to represent constructed points exactly. This is due to the fact that the coordinates of an intersection point may contain twice as many bits of precision as the coordinates of the input line segments. In order to represent these constructed points explicitly, JTS must truncate them to fit the
PrecisionModel.
Unfortunately, truncating coordinates moves them slightly. Line segments which would not be coincident in the exact result may become coincident in the truncated representation. This in turn leads to "topology collapses" -- situations where a computed element has a lower dimension than it would in the exact result.
When JTS detects topology collapses during the computation of spatial analysis methods, it will throw an exception. If possible the exception will report the location of the collapse.
Since equals(Object) and hashCode() are overridden, Geometries can be used effectively in Java collections.
Geometry via the specified GeometryFactory.
Geometrys actual class
Geometrys.
Geometrys; no elements may be
null
true if any of the
Geometrys
isEmpty methods return
false
null elements.
true if any of
arrays elements are
null
Geometry.
JTS supports Spatial Reference System information in the simple way defined in the SFS. A Spatial Reference System ID (SRID) is present in each Geometry object. Geometry provides basic accessor operations for this field, but no others. The SRID is represented as an integer.
Geometry is defined.
Geometry.
NOTE: This method should only be used for exceptional circumstances or for backwards compatibility. Normally the SRID should be set on the GeometryFactory used to create the geometry. SRIDs set using this method will not be propagated to geometries returned by constructive methods.
null if none set
this, if the geometry is not a collection).
Note that user data objects are not present in geometries created by construction methods.
PrecisionModel used by the
Geometry.
Geometry and all other
Geometrys
Geometry (usually, but not necessarily, the first one). The returned coordinate should not be assumed to be an actual Coordinate object used in the internal representation.
Geometry.
In general, the array cannot be assumed to be the actual internal storage for the vertices. Thus modifying the array may not modify the geometry itself. Use the CoordinateSequence.setOrdinate method (possibly on the components) to modify the underlying data. If the coordinates are modified, geometryChanged must be called afterwards.
Geometry
Geometrys vertices. The
Geometry s contained by composite
Geometrys must be Geometry's; that is, they must implement
getNumPoints
Geometry
Simplicity is defined for each Geometry subclass as follows:
isSimple tests for this condition and reports false if it is not met. (This is a looser test than checking for validity). Geometrys are always simple. true if this
Geometry is simple
Geometry is topologically valid, according to the OGC SFS specification.
For validity rules see the Javadoc for the specific Geometry subclass.
true if this
Geometry is valid
Geometry is empty.
true if this
Geometry does not cover any points
Geometry and another
Geometry.
Geometry from which to compute the distance
Geometry to another is less than or equal to a specified value.
true if the geometries are less than
distance apart.
Geometry. Areal Geometries have a non-zero area. They override this function to compute the area. Others return 0.0
Geometry. Linear geometries return their length. Areal geometries return their perimeter. They override this function to compute the area. Others return 0.0
Geometry. The centroid is equal to the centroid of the set of component Geometries of highest dimension (since the lower-dimension geometries contribute zero "weight" to the centroid).
The centroid of an empty geometry is POINT EMPTY.
Geometry. An interior point is guaranteed to lie in the interior of the Geometry, if it possible to calculate such a point exactly. Otherwise, the point may lie on the boundary of the geometry.
The interior point of an empty geometry is POINT EMPTY.
Note that this is a different concept to the dimension of the vertex Coordinates. The geometry dimension can never be greater than the coordinate dimension. For example, a 0-dimensional geometry (e.g. a Point) may have a coordinate dimension of 3 (X,Y,Z).
Geometry is empty. (In the case of zero-dimensional geometries, ' an empty GeometryCollection is returned.) For a discussion of this function, see the OpenGIS Simple Features Specification. As stated in SFS Section 2.1.13.1, "the boundary of a Geometry is a set of Geometries of the next lower dimension."
Geometry
Geometrys inherent boundary.
Dimension.FALSE if the boundary is the empty geometry.
Geometry.
If this Geometry is:
Point. Point. LineString Polygon whose vertices are (minx miny, maxx miny, maxx maxy, minx maxy, minx miny). Geometry. If the geometry is empty, an empty
Envelope is returned.
The returned object is a copy of the one maintained internally, to avoid aliasing issues. For best performance, clients which access this envelope frequently should cache the return value.
Geometry.
The disjoint predicate has the following equivalent definitions:
[FF*FF****] ! g.intersects(this) = true disjoint is the inverse of intersects) Geometry with which to compare this
Geometry
true if the two
Geometrys are disjoint
The touches predicate has the following equivalent definitions:
[FT*******] [F**T*****] [F***T****] false, since points have only interiors. This predicate is symmetric.
Geometry with which to compare this
Geometry
true if the two
Geometrys touch; Returns
false if both
Geometrys are points
The intersects predicate has the following equivalent definitions:
[T********] [*T*******] [***T*****] [****T****] ! g.disjoint(this) = true intersects is the inverse of disjoint) Geometry with which to compare this
Geometry
true if the two
Geometrys intersect
The crosses predicate has the following equivalent definitions:
[T*T******] (for P/L, P/A, and L/A situations) [T*****T**] (for L/P, A/P, and A/L situations) [0********] (for L/L situations) false.
The SFS defined this predicate only for P/L, P/A, L/L, and L/A situations. In order to make the relation symmetric, JTS extends the definition to apply to L/P, A/P and A/L situations as well.
Geometry with which to compare this
Geometry
true if the two
Geometrys cross.
The within predicate has the following equivalent definitions:
[T*F**F***] g.contains(this) = true within is the converse of contains) A.within(B) = false (As a concrete example, take A to be a LineString which lies in the boundary of a Polygon B.) For a predicate with similar behaviour but avoiding this subtle limitation, see
coveredBy.
Geometry with which to compare this
Geometry
true if this
Geometry is within
g
The contains predicate has the following equivalent definitions:
[T*****FF*] g.within(this) = true contains is the converse of within ) B.contains(A) = false. (As a concrete example, take A to be a LineString which lies in the boundary of a Polygon B.) For a predicate with similar behaviour but avoiding this subtle limitation, see
covers.
Geometry with which to compare this
Geometry
true if this
Geometry contains
g
The overlaps predicate has the following equivalent definitions:
[T*T***T**] (for two points or two surfaces) or [1*T***T**] (for two curves) false. This predicate is symmetric.
Geometry with which to compare this
Geometry
true if the two
Geometrys overlap.
The covers predicate has the following equivalent definitions:
[T*****FF*] [*T****FF*] [***T**FF*] [****T*FF*] g.coveredBy(this) = true covers is the converse of coveredBy) false.
This predicate is similar to contains, but is more inclusive (i.e. returns true for more cases). In particular, unlike contains it does not distinguish between points in the boundary and in the interior of geometries. For most situations, covers should be used in preference to contains. As an added benefit, covers is more amenable to optimization, and hence should be more performant.
Geometry with which to compare this
Geometry
true if this
Geometry covers
g
The coveredBy predicate has the following equivalent definitions:
[T*F**F***] [*TF**F***] [**FT*F***] [**F*TF***] g.covers(this) = true coveredBy is the converse of covers) false.
This predicate is similar to within, but is more inclusive (i.e. returns true for more cases).
Geometry with which to compare this
Geometry
true if this
Geometry is covered by
g
Geometrys match the elements in
intersectionPattern. The pattern is a 9-character string, with symbols drawn from the following set:
Geometry with which to compare this
Geometry
Geometrys
true if the DE-9IM intersection matrix for the two
Geometrys match
intersectionPattern
Geometrys.
Geometry with which to compare this
Geometry
Geometrys
This method is included for backward compatibility reasons. It has been superseded by the equalsTopo(Geometry) method, which has been named to clearly denote its functionality.
This method should NOT be confused with the method equals(Object), which implements an exact equality comparison.
Geometry with which to compare this
Geometry
Geometrys are topologically equal
equals predicate.
The SFS equals predicate has the following equivalent definitions:
T*F**FFF* T*F **F FF*
Geometry with which to compare this
Geometry
true if the two
Geometrys are topologically equal
Object. If the argument
Object is not a
Geometry, the result is
false. Otherwise, the result is computed using
equalsExact(Geometry).
This method is provided to fulfill the Java contract for value-based object equality. In conjunction with hashCode() it provides semantics which are most useful for using Geometrys as keys and values in Java collections.
Note that to produce the expected result the input geometries should be in normal form. It is the caller's responsibility to perform this where required (using Geometry.norm() or normalize() as appropriate).
Geometry. For a definition of the Well-known Text format, see the OpenGIS Simple Features Specification.
Geometry
abs(distance).
Mathematically-exact buffer area boundaries can contain circular arcs. To represent these arcs using linear geometry they must be approximated with line segments. The buffer geometry is constructed using 8 segments per quadrant to approximate the circular arcs. The end cap style is CAP_ROUND.
The buffer operation always returns a polygonal result. The negative or zero-distance buffer of lines and points is always an empty Polygon. This is also the result for the buffers of degenerate (zero-area) polygons.
Mathematically-exact buffer area boundaries can contain circular arcs. To represent these arcs using linear geometry they must be approximated with line segments. The quadrantSegments argument allows controlling the accuracy of the approximation by specifying the number of line segments used to represent a quadrant of a circle
The buffer operation always returns a polygonal result. The negative or zero-distance buffer of lines and points is always an empty Polygon. This is also the result for the buffers of degenerate (zero-area) polygons.
Mathematically-exact buffer area boundaries can contain circular arcs. To represent these arcs using linear geometry they must be approximated with line segments. The quadrantSegments argument allows controlling the accuracy of the approximation by specifying the number of line segments used to represent a quadrant of a circle
The end cap style specifies the buffer geometry that will be created at the ends of linestrings. The styles provided are:
BufferOp.CAP_ROUND - (default) a semi-circle BufferOp.CAP_BUTT - a straight line perpendicular to the end segment BufferOp.CAP_SQUARE - a half-square The buffer operation always returns a polygonal result. The negative or zero-distance buffer of lines and points is always an empty Polygon. This is also the result for the buffers of degenerate (zero-area) polygons.
Polygon that contains all the points in the
Geometry. This obviously applies only to
Geometry s which contain 3 or more points; the results for degenerate cases are specified as follows:
Number of Points in argument Geometry |
Geometry class of result |
|---|---|
| 0 | empty GeometryCollection |
| 1 | Point |
| 2 | LineString |
| 3 or more | Polygon |
Geometry' s points
Geometry representing the point-set which is common to both this
Geometry and the
other Geometry.
The intersection of two geometries of different dimension produces a result geometry of dimension less than or equal to the minimum dimension of the input geometries. The result geometry may be a heterogeneous GeometryCollection. If the result is empty, it is an atomic geometry with the dimension of the lowest input dimension.
Intersection of GeometryCollections is supported only for homogeneous collection types.
Non-empty heterogeneous GeometryCollection arguments are not supported.
Geometry with which to compute the intersection
Geometrys
GeometryCollection
Geometry representing the point-set which is contained in both this
Geometry and the
other Geometry.
The union of two geometries of different dimension produces a result geometry of dimension equal to the maximum dimension of the input geometries. The result geometry may be a heterogeneous GeometryCollection. If the result is empty, it is an atomic geometry with the dimension of the highest input dimension.
Unioning LineStrings has the effect of noding and dissolving the input linework. In this context "noding" means that there will be a node or endpoint in the result for every endpoint or line segment crossing in the input. "Dissolving" means that any duplicate (i.e. coincident) line segments or portions of line segments will be reduced to a single line segment in the result. If merged linework is required, the LineMerger class can be used.
Non-empty GeometryCollection arguments are not supported.
Geometry with which to compute the union
Geometry and the points of
other
Geometry representing the closure of the point-set of the points contained in this
Geometry that are not contained in the
other Geometry.
If the result is empty, it is an atomic geometry with the dimension of the left-hand input.
Non-empty GeometryCollection arguments are not supported.
Geometry with which to compute the difference
Geometry with
other
Geometry representing the closure of the point-set which is the union of the points in this
Geometry which are not contained in the
other Geometry, with the points in the
other Geometry not contained in this
Geometry. If the result is empty, it is an atomic geometry with the dimension of the highest input dimension.
Non-empty GeometryCollection arguments are not supported.
Geometry with which to compute the symmetric difference
Geometry with
other
This method supports GeometryCollections (which the other overlay operations currently do not).
The result obeys the following contract:
Geometrys are exactly equal, up to a specified distance tolerance. Two Geometries are exactly equal within a distance tolerance if and only if:
GeometryFactory, the
SRID, or the
userData fields.
To properly test equality between different geometries, it is usually necessary to normalize() them first.
Geometry with which to compare this
Geometry
Coordinates are considered equal
true if this and the other
Geometry have identical structure and point values, up to the distance tolerance.
Geometrys are exactly equal. Two Geometries are exactly equal iff:
This method does not test the values of the GeometryFactory, the SRID, or the userData fields.
To properly test equality between different geometries, it is usually necessary to normalize() them first.
Geometry with which to compare this
Geometry
true if this and the other
Geometry have identical structure and point values.
This method is relatively expensive to compute. For maximum performance, the client should instead perform normalization on the individual geometries at an appropriate point during processing.
Geometry's coordinates. If this method modifies any coordinate values,
geometryChanged must be called to update the geometry state. Note that you cannot use this method to modify this Geometry if its underlying CoordinateSequence's #get method returns a copy of the Coordinate, rather than the actual Coordinate stored (if it even stores Coordinate objects at all).
Geometry's coordinates
Geometry's
CoordinateSequences. If the filter reports that a coordinate value has been changed,
geometryChanged will be called automatically.
Geometry and its subelement
Geometrys (if any). Only GeometryCollections and subclasses have subelement Geometry's.
Geometry (and its children, if it is a
GeometryCollection).
Geometry.
envelope,
SRID and
userData).
NOTE: the userData object reference (if present) is copied, but the value itself is not copied. If a deep copy is required this must be performed by the caller.
Geometry to
normal form (or
canonical form ). Normal form is a unique representation for
Geometry s. It can be used to test whether two
Geometrys are equal in a way that is independent of the ordering of the coordinates within them. Normal form equality is a stronger condition than topological equality, but weaker than pointwise equality. The definitions for normal form use the standard lexicographical ordering for coordinates. "Sorted in order of coordinates" means the obvious extension of this ordering to sequences of coordinates.
NOTE that this method mutates the value of this geometry in-place. If this is not safe and/or wanted, the geometry should be cloned prior to normalization.
Geometry is greater than, equal to, or less than another
Geometry.
If their classes are different, they are compared using the following ordering:
Geometrys have the same class, their first elements are compared. If those are the same, the second elements are compared, etc.
Geometry with which to compare this
Geometry
o, as defined in "Normal Form For Geometry" in the JTS Technical Specifications
Geometry is greater than, equal to, or less than another
Geometry, using the given
CoordinateSequenceComparator.
If their classes are different, they are compared using the following ordering:
Geometrys have the same class, their first elements are compared. If those are the same, the second elements are compared, etc.
Geometry with which to compare this
Geometry
CoordinateSequenceComparator
o, as defined in "Normal Form For Geometry" in the JTS Technical Specifications
Geometrys are equal, from the point of view of the
equalsExact method. Called by
equalsExact . In general, two
Geometry classes are considered to be "equivalent" only if they are the same class. An exception is
LineString , which is considered to be equivalent to its subclasses.
Geometry with which to compare this
Geometry for equality
true if the classes of the two
Geometry s are considered to be equal by the
equalsExact method.
g's type is a
GeometryCollection. (Its subclasses do not trigger an exception).
Geometry to check
g is a
GeometryCollection but not one of its subclasses
Geometry , or a null
Envelope if this
Geometry is empty. Unlike
getEnvelopeInternal, this method calculates the
Envelope each time it is called;
getEnvelopeInternal caches the result of this method.
Geometrys bounding box; if the
Geometry is empty,
Envelope#isNull will return
true
Geometry is greater than, equal to, or less than another
Geometry having the same class.
Geometry having the same class as this
Geometry
o, as defined in "Normal Form For Geometry" in the JTS Technical Specifications
Geometry is greater than, equal to, or less than another
Geometry of the same class. using the given
CoordinateSequenceComparator.
Geometry having the same class as this
Geometry
CoordinateSequenceComparator
o, as defined in "Normal Form For Geometry" in the JTS Technical Specifications
compareTo encountered as the two
Collections are iterated over. If, by the time one of the iterations is complete, no non-zero result has been encountered, returns 0 if the other iteration is also complete. If
b completes before
a, a positive number is returned; if a before b, a negative number.
Collection of
Comparables
Collection of
Comparables
compareTo result, if any; otherwise, zero