MultiPolygon

@SerialVersionUID(-551033529766975875L) class MultiPolygon(val polygons: Array[Polygon], val factory: GeometryFactory) extends GeometryCollection with Polygonal

Models a collection of {link Polygon}s.

As per the OGC SFS specification, the Polygons in a MultiPolygon may not overlap, and may only touch at single points. This allows the topological point-set semantics to be well-defined.

Version

1.7

trait Polygonal
class Geometry
trait Serializable
trait Comparable[Geometry]
trait Cloneable
class Object
trait Matchable
class Any

Value members

Constructors

def this(polygons: Array[Polygon], precisionModel: PrecisionModel, SRID: Int)

Constructs a <code>MultiPolygon</code>.

Constructs a <code>MultiPolygon</code>.

Value Params
SRID

the ID of the Spatial Reference System used by this <code>MultiPolygon</code>

polygons

the <code>Polygon</code>s for this <code>MultiPolygon</code> , or <code>null</code> or an empty array to create the empty geometry. Elements may be empty <code>Polygon</code>s, but not <code>null</code> s. The polygons must conform to the assertions specified in the <A HREF="http://www.opengis.org/techno/specs.htm">OpenGIS Simple Features Specification for SQL</A> .

precisionModel

the specification of the grid of allowable points for this <code>MultiPolygon</code>

Concrete methods

override def equalsExact(other: Geometry, tolerance: Double): Boolean
Definition Classes
override def getBoundary: Geometry

Computes the boundary of this geometry

Computes the boundary of this geometry

return a lineal geometry (which may be empty)

See also

Geometry#getBoundary

Definition Classes
override def getBoundaryDimension: Int
Definition Classes
override def getDimension: Int
Definition Classes
override def getGeometryType: String
Definition Classes
override def reverse: Geometry

Creates a {link MultiPolygon} with every component reversed. The order of the components in the collection are not reversed.

Creates a {link MultiPolygon} with every component reversed. The order of the components in the collection are not reversed.

return a MultiPolygon in the reverse order

Definition Classes

Inherited methods

def applyF(filter: GeometryComponentFilter): Unit
Inherited from
GeometryCollection
def applyF(filter: GeometryFilter): Unit
Inherited from
GeometryCollection
def applyF(filter: CoordinateSequenceFilter): Unit
Inherited from
GeometryCollection
def applyF(filter: CoordinateFilter): Unit
Inherited from
GeometryCollection
def buffer(distance: Double, quadrantSegments: Int, endCapStyle: Int): Geometry

Computes a buffer area around this geometry having the given width and with a specified accuracy of approximation for circular arcs, and using a specified end cap style.

Computes a buffer area around this geometry having the given width and with a specified accuracy of approximation for circular arcs, and using a specified end cap style.

Mathematically-exact buffer area boundaries can contain circular arcs. To represent these arcs using linear geometry they must be approximated with line segments. The <code>quadrantSegments</code> 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:

  • <code>BufferOp.CAP_ROUND</code> - (default) a semi-circle

  • <code>BufferOp.CAP_BUTT</code> - a straight line perpendicular to the end segment

  • <code>BufferOp.CAP_SQUARE</code> - 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 {link Polygon}. This is also the result for the buffers of degenerate (zero-area) polygons.

Value Params
distance

the width of the buffer (may be positive, negative or 0)

endCapStyle

the end cap style to use return a polygonal geometry representing the buffer region (which may be empty) throws TopologyException if a robustness error occurs

quadrantSegments

the number of line segments used to represent a quadrant of a circle

See also

#buffer(double)

#buffer(double, int)

BufferOp

Inherited from
Geometry
def buffer(distance: Double, quadrantSegments: Int): Geometry

Computes a buffer area around this geometry having the given width and with a specified accuracy of approximation for circular arcs.

Computes a buffer area around this geometry having the given width and with a specified accuracy of approximation for circular arcs.

Mathematically-exact buffer area boundaries can contain circular arcs. To represent these arcs using linear geometry they must be approximated with line segments. The <code>quadrantSegments</code> 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 {link Polygon}. This is also the result for the buffers of degenerate (zero-area) polygons.

Value Params
distance

the width of the buffer (may be positive, negative or 0)

quadrantSegments

the number of line segments used to represent a quadrant of a circle return a polygonal geometry representing the buffer region (which may be empty) throws TopologyException if a robustness error occurs

See also

#buffer(double)

#buffer(double, int, int)

Inherited from
Geometry
def buffer(distance: Double): Geometry

Computes a buffer area around this geometry having the given width. The buffer of a Geometry is the Minkowski sum or difference of the geometry with a disc of radius <code>abs(distance)</code>.

Computes a buffer area around this geometry having the given width. The buffer of a Geometry is the Minkowski sum or difference of the geometry with a disc of radius <code>abs(distance)</code>.

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 <code>CAP_ROUND</code>.

The buffer operation always returns a polygonal result. The negative or zero-distance buffer of lines and points is always an empty {link Polygon}. This is also the result for the buffers of degenerate (zero-area) polygons.

Value Params
distance

the width of the buffer (may be positive, negative or 0) return a polygonal geometry representing the buffer region (which may be empty) throws TopologyException if a robustness error occurs

See also

#buffer(double, int)

#buffer(double, int, int)

Inherited from
Geometry
override def clone: AnyRef

Creates and returns a full copy of this {link GeometryCollection} object. (including all coordinates contained by it).

Creates and returns a full copy of this {link GeometryCollection} object. (including all coordinates contained by it).

return a clone of this instance

Definition Classes
Inherited from
GeometryCollection
def compare[A](a: Collection[A], b: Collection[A], comparator: Comparator[A]): Int

Returns the first non-zero result of <code>compareTo</code> encountered as the two <code>Collection</code>s 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 <code>b</code> completes before <code>a</code>, a positive number is returned; if a before b, a negative number.

Returns the first non-zero result of <code>compareTo</code> encountered as the two <code>Collection</code>s 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 <code>b</code> completes before <code>a</code>, a positive number is returned; if a before b, a negative number.

Value Params
a

a <code>Collection</code> of <code>Comparable</code>s

b

a <code>Collection</code> of <code>Comparable</code>s return the first non-zero <code>compareTo</code> result, if any; otherwise, zero

Inherited from
Geometry

Returns whether this <code>Geometry</code> is greater than, equal to, or less than another <code>Geometry</code>, using the given {link CoordinateSequenceComparator}.

Returns whether this <code>Geometry</code> is greater than, equal to, or less than another <code>Geometry</code>, using the given {link CoordinateSequenceComparator}.

<P>

If their classes are different, they are compared using the following ordering:

<UL> <LI> Point (lowest) <LI> MultiPoint <LI> LineString <LI> LinearRing <LI> MultiLineString <LI> Polygon <LI> MultiPolygon <LI> GeometryCollection (highest) </UL> If the two <code>Geometry</code>s have the same class, their first elements are compared. If those are the same, the second elements are compared, etc.

Value Params
comp

a <code>CoordinateSequenceComparator</code> return a positive number, 0, or a negative number, depending on whether this object is greater than, equal to, or less than <code>o</code>, as defined in "Normal Form For Geometry" in the JTS Technical Specifications

o

a <code>Geometry</code> with which to compare this <code>Geometry</code>

Inherited from
Geometry
override def compareTo(other: Geometry): Int

Returns whether this <code>Geometry</code> is greater than, equal to, or less than another <code>Geometry</code>. <P>

Returns whether this <code>Geometry</code> is greater than, equal to, or less than another <code>Geometry</code>. <P>

If their classes are different, they are compared using the following ordering:

<UL> <LI> Point (lowest) <LI> MultiPoint <LI> LineString <LI> LinearRing <LI> MultiLineString <LI> Polygon <LI> MultiPolygon <LI> GeometryCollection (highest) </UL> If the two <code>Geometry</code>s have the same class, their first elements are compared. If those are the same, the second elements are compared, etc.

Value Params
o

a <code>Geometry</code> with which to compare this <code>Geometry</code> return a positive number, 0, or a negative number, depending on whether this object is greater than, equal to, or less than <code>o</code>, as defined in "Normal Form For Geometry" in the JTS Technical Specifications

Definition Classes
Geometry -> Comparable
Inherited from
Geometry
def contains(g: Geometry): Boolean

Tests whether this geometry contains the argument geometry.

Tests whether this geometry contains the argument geometry.

The <code>contains</code> predicate has the following equivalent definitions:

  • Every point of the other geometry is a point of this geometry, and the interiors of the two geometries have at least one point in common.

  • The DE-9IM Intersection Matrix for the two geometries matches the pattern <code>[T*****FF*]</code>

  • <code>g.within(this) = true</code> <br>(<code>contains</code> is the converse of {link #within} )

An implication of the definition is that "Geometries do not contain their boundary". In other words, if a geometry A is a subset of the points in the boundary of a geometry B, <code>B.contains(A) = false</code>. (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 {link #covers}.

Value Params
g

the <code>Geometry</code> with which to compare this <code>Geometry</code> return <code>true</code> if this <code>Geometry</code> contains <code>g</code>

See also

Geometry#within

Geometry#covers

Inherited from
Geometry

Computes the smallest convex <code>Polygon</code> that contains all the points in the <code>Geometry</code>. This obviously applies only to <code>Geometry</code> s which contain 3 or more points; the results for degenerate cases are specified as follows:

Computes the smallest convex <code>Polygon</code> that contains all the points in the <code>Geometry</code>. This obviously applies only to <code>Geometry</code> s which contain 3 or more points; the results for degenerate cases are specified as follows:

<TABLE> <TR> <TH> Number of <code>Point</code>s in argument <code>Geometry</code> </TH> <TH> <code>Geometry</code> class of result </TH> </TR> <TR> <TD> 0 </TD> <TD> empty <code>GeometryCollection</code> </TD> </TR> <TR> <TD> 1 </TD> <TD> <code>Point</code> </TD> </TR> <TR> <TD> 2 </TD> <TD> <code>LineString</code> </TD> </TR> <TR> <TD> 3 or more </TD> <TD> <code>Polygon</code> </TD> </TR> </TABLE>

return the minimum-area convex polygon containing this <code>Geometry</code>' s points

Inherited from
Geometry

Creates a deep copy of this {link Geometry} object. Coordinate sequences contained in it are copied. All instance fields are copied (i.e. <code>envelope</code>, <tt>SRID</tt> and <tt>userData</tt>).

Creates a deep copy of this {link Geometry} object. Coordinate sequences contained in it are copied. All instance fields are copied (i.e. <code>envelope</code>, <tt>SRID</tt> and <tt>userData</tt>).

<b>NOTE:</b> 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.

return a deep copy of this geometry

Inherited from
Geometry
def coveredBy(g: Geometry): Boolean

Tests whether this geometry is covered by the argument geometry.

Tests whether this geometry is covered by the argument geometry.

The <code>coveredBy</code> predicate has the following equivalent definitions:

  • Every point of this geometry is a point of the other geometry.

  • The DE-9IM Intersection Matrix for the two geometries matches at least one of the following patterns:

  • <code>[TFF]</code>

  • <code>[TFF]</code>

  • <code>[FTF]</code>

  • <code>[FTF]</code>

  • <code>g.covers(this) = true</code> <br>(<code>coveredBy</code> is the converse of {link #covers})

If either geometry is empty, the value of this predicate is <code>false</code>.

This predicate is similar to {link #within}, but is more inclusive (i.e. returns <code>true</code> for more cases).

Value Params
g

the <code>Geometry</code> with which to compare this <code>Geometry</code> return <code>true</code> if this <code>Geometry</code> is covered by <code>g</code>

See also

Geometry#within

Geometry#covers

Inherited from
Geometry
def covers(g: Geometry): Boolean

Tests whether this geometry covers the argument geometry.

Tests whether this geometry covers the argument geometry.

The <code>covers</code> predicate has the following equivalent definitions:

  • Every point of the other geometry is a point of this geometry.

  • The DE-9IM Intersection Matrix for the two geometries matches at least one of the following patterns:

  • <code>[T*****FF*]</code>

  • <code>[T**FF]</code>

  • <code>[TFF]</code>

  • <code>[**TFF]</code>

  • <code>g.coveredBy(this) = true</code> <br>(<code>covers</code> is the converse of {link #coveredBy})

If either geometry is empty, the value of this predicate is <code>false</code>.

This predicate is similar to {link #contains}, but is more inclusive (i.e. returns <code>true</code> for more cases). In particular, unlike <code>contains</code> it does not distinguish between points in the boundary and in the interior of geometries. For most situations, <code>covers</code> should be used in preference to <code>contains</code>. As an added benefit, <code>covers</code> is more amenable to optimization, and hence should be more performant.

Value Params
g

the <code>Geometry</code> with which to compare this <code>Geometry</code> return <code>true</code> if this <code>Geometry</code> covers <code>g</code>

See also

Geometry#contains

Geometry#coveredBy

Inherited from
Geometry
def crosses(g: Geometry): Boolean

Tests whether this geometry crosses the argument geometry.

Tests whether this geometry crosses the argument geometry.

The <code>crosses</code> predicate has the following equivalent definitions:

  • The geometries have some but not all interior points in common.

  • The DE-9IM Intersection Matrix for the two geometries matches one of the following patterns:

  • <code>[TT*****]</code> (for P/L, P/A, and L/A situations)

  • <code>[T***T]</code> (for L/P, A/P, and A/L situations)

  • <code>[0********]</code> (for L/L situations)

For any other combination of dimensions this predicate returns <code>false</code>.

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.

Value Params
g

the <code>Geometry</code> with which to compare this <code>Geometry</code> return <code>true</code> if the two <code>Geometry</code>s cross.

Inherited from
Geometry

Computes a <code>Geometry</code> representing the closure of the point-set of the points contained in this <code>Geometry</code> that are not contained in the <code>other</code> Geometry.

Computes a <code>Geometry</code> representing the closure of the point-set of the points contained in this <code>Geometry</code> that are not contained in the <code>other</code> Geometry.

If the result is empty, it is an atomic geometry with the dimension of the left-hand input.

Non-empty {link GeometryCollection} arguments are not supported.

Value Params
other

the <code>Geometry</code> with which to compute the difference return a Geometry representing the point-set difference of this <code>Geometry</code> with <code>other</code> throws TopologyException if a robustness error occurs throws IllegalArgumentException if either input is a non-empty GeometryCollection

Inherited from
Geometry
def disjoint(g: Geometry): Boolean

Tests whether this geometry is disjoint from the argument geometry.

Tests whether this geometry is disjoint from the argument geometry.

The <code>disjoint</code> predicate has the following equivalent definitions:

  • The two geometries have no point in common

  • The DE-9IM Intersection Matrix for the two geometries matches <code>[FFFF***]</code>

  • <code>! g.intersects(this) = true</code> <br>(<code>disjoint</code> is the inverse of <code>intersects</code>)

Value Params
g

the <code>Geometry</code> with which to compare this <code>Geometry</code> return <code>true</code> if the two <code>Geometry</code>s are disjoint

See also

Geometry#intersects

Inherited from
Geometry
def distance(g: Geometry): Double

Returns the minimum distance between this <code>Geometry</code> and another <code>Geometry</code>.

Returns the minimum distance between this <code>Geometry</code> and another <code>Geometry</code>.

Value Params
g

the <code>Geometry</code> from which to compute the distance return the distance between the geometries return 0 if either input geometry is empty throws IllegalArgumentException if g is null

Inherited from
Geometry
override def equals(o: Any): Boolean

Tests whether this geometry is structurally and numerically equal to a given <code>Object</code>. If the argument <code>Object</code> is not a <code>Geometry</code>, the result is <code>false</code>. Otherwise, the result is computed using {link #equalsExact(Geometry)}.

Tests whether this geometry is structurally and numerically equal to a given <code>Object</code>. If the argument <code>Object</code> is not a <code>Geometry</code>, the result is <code>false</code>. Otherwise, the result is computed using {link #equalsExact(Geometry)}.

This method is provided to fulfill the Java contract for value-based object equality. In conjunction with {link #hashCode()} it provides semantics which are most useful for using <code>Geometry</code>s 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 {link Geometry#norm()} or {link #normalize()} as appropriate).

Value Params
o

the Object to compare return true if this geometry is exactly equal to the argument

See also

#equalsExact(Geometry)

#hashCode()

#norm()

#normalize()

Definition Classes
Geometry -> Any
Inherited from
Geometry
def equals(g: Geometry): Boolean

Tests whether this geometry is topologically equal to the argument geometry.

Tests whether this geometry is topologically equal to the argument geometry.

This method is included for backward compatibility reasons. It has been superseded by the {link #equalsTopo(Geometry)} method, which has been named to clearly denote its functionality.

This method should NOT be confused with the method {link #equals(Object)}, which implements an exact equality comparison.

Value Params
g

the <code>Geometry</code> with which to compare this <code>Geometry</code> return true if the two <code>Geometry</code>s are topologically equal

See also

#equalsTopo(Geometry)

Inherited from
Geometry
def equalsExact(other: Geometry): Boolean

Returns true if the two <code>Geometry</code>s are exactly equal. Two Geometries are exactly equal iff:

Returns true if the two <code>Geometry</code>s are exactly equal. Two Geometries are exactly equal iff:

  • they have the same structure

  • they have the same values for their vertices, in exactly the same order.

This provides a stricter test of equality than {link #equalsTopo(Geometry)}, which is more useful in certain situations (such as using geometries as keys in collections).

This method does <i>not</i> test the values of the <code>GeometryFactory</code>, the <code>SRID</code>, or the <code>userData</code> fields.

To properly test equality between different geometries, it is usually necessary to {link #normalize()} them first.

Value Params
other

the <code>Geometry</code> with which to compare this <code>Geometry</code> return <code>true</code> if this and the other <code>Geometry</code> have identical structure and point values.

See also

#equalsExact(Geometry, double)

#normalize()

#norm()

Inherited from
Geometry
def equalsNorm(g: Geometry): Boolean

Tests whether two geometries are exactly equal in their normalized forms. This is a convenience method which creates normalized versions of both geometries before computing {link #equalsExact(Geometry)}.

Tests whether two geometries are exactly equal in their normalized forms. This is a convenience method which creates normalized versions of both geometries before computing {link #equalsExact(Geometry)}.

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.

Value Params
g

a Geometry return true if the input geometries are exactly equal in their normalized form

Inherited from
Geometry
def equalsTopo(g: Geometry): Boolean

Tests whether this geometry is topologically equal to the argument geometry as defined by the SFS <code>equals</code> predicate.

Tests whether this geometry is topologically equal to the argument geometry as defined by the SFS <code>equals</code> predicate.

The SFS <code>equals</code> predicate has the following equivalent definitions:

  • The two geometries have at least one point in common, and no point of either geometry lies in the exterior of the other geometry.

  • The DE-9IM Intersection Matrix for the two geometries matches the pattern <code>TF**FFF</code>

<pre> T*F **F FF* </pre>

<b>Note</b> that this method computes <b>topologically equality</b>. For structural equality, see {link #equalsExact(Geometry)}.

Value Params
g

the <code>Geometry</code> with which to compare this <code>Geometry</code> return <code>true</code> if the two <code>Geometry</code>s are topologically equal

See also

#equalsExact(Geometry)

Inherited from
Geometry
def geometryChanged(): Unit

Notifies this geometry that its coordinates have been changed by an external party (for example, via a {link CoordinateFilter}). When this method is called the geometry will flush and/or update any derived information it has cached (such as its {link Envelope} ). The operation is applied to all component Geometries.

Notifies this geometry that its coordinates have been changed by an external party (for example, via a {link CoordinateFilter}). When this method is called the geometry will flush and/or update any derived information it has cached (such as its {link Envelope} ). The operation is applied to all component Geometries.

Inherited from
Geometry
override def getArea: Double

Returns the area of this <code>GeometryCollection</code>

Returns the area of this <code>GeometryCollection</code>

return the area of the polygon

Definition Classes
Inherited from
GeometryCollection

Computes the centroid of this <code>Geometry</code>. 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).

Computes the centroid of this <code>Geometry</code>. 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 <code>POINT EMPTY</code>.

return a { @link Point} which is the centroid of this Geometry

Inherited from
Geometry
Definition Classes
Inherited from
GeometryCollection
override def getCoordinates: Array[Coordinate]

Collects all coordinates of all subgeometries into an Array.

Collects all coordinates of all subgeometries into an Array.

Note that while changes to the coordinate objects themselves may modify the Geometries in place, the returned Array as such is only a temporary container which is not synchronized back.

return the collected coordinates

Definition Classes
Inherited from
GeometryCollection

Gets a Geometry representing the envelope (bounding box) of this <code>Geometry</code>.

Gets a Geometry representing the envelope (bounding box) of this <code>Geometry</code>.

If this <code>Geometry</code> is:

  • empty, returns an empty <code>Point</code>.

  • a point, returns a <code>Point</code>.

  • a line parallel to an axis, a two-vertex <code>LineString</code>

  • otherwise, returns a <code>Polygon</code> whose vertices are (minx miny, maxx miny, maxx maxy, minx maxy, minx miny).

return a Geometry representing the envelope of this Geometry

See also

GeometryFactory#toGeometry(Envelope)

Inherited from
Geometry

Gets an {link Envelope} containing the minimum and maximum x and y values in this <code>Geometry</code>. If the geometry is empty, an empty <code>Envelope</code> is returned.

Gets an {link Envelope} containing the minimum and maximum x and y values in this <code>Geometry</code>. If the geometry is empty, an empty <code>Envelope</code> 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.

return the envelope of this <code>Geometry</code>. return an empty Envelope if this Geometry is empty

Inherited from
Geometry

Gets the factory which contains the context in which this geometry was created.

Gets the factory which contains the context in which this geometry was created.

return the factory for this geometry

Inherited from
Geometry
override def getGeometryN(n: Int): Geometry
Definition Classes
Inherited from
GeometryCollection

Computes an interior point of this <code>Geometry</code>. 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.

Computes an interior point of this <code>Geometry</code>. 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 <code>POINT EMPTY</code>.

return a { @link Point} which is in the interior of this Geometry

Inherited from
Geometry
override def getLength: Double
Definition Classes
Inherited from
GeometryCollection
override def getNumGeometries: Int
Definition Classes
Inherited from
GeometryCollection
override def getNumPoints: Int
Definition Classes
Inherited from
GeometryCollection

Returns the <code>PrecisionModel</code> used by the <code>Geometry</code>.

Returns the <code>PrecisionModel</code> used by the <code>Geometry</code>.

return the specification of the grid of allowable points, for this <code>Geometry</code> and all other <code>Geometry</code>s

Inherited from
Geometry
def getSRID: Int

Returns the ID of the Spatial Reference System used by the <code>Geometry</code>.

Returns the ID of the Spatial Reference System used by the <code>Geometry</code>.

<P>

JTS supports Spatial Reference System information in the simple way defined in the SFS. A Spatial Reference System ID (SRID) is present in each <code>Geometry</code> object. <code>Geometry</code> provides basic accessor operations for this field, but no others. The SRID is represented as an integer.

return the ID of the coordinate space in which the <code>Geometry</code> is defined.

Inherited from
Geometry
def getUserData: Object

Gets the user data object for this geometry, if any.

Gets the user data object for this geometry, if any.

return the user data object, or <code>null</code> if none set

Inherited from
Geometry
override def hashCode: Int

Gets a hash code for the Geometry.

Gets a hash code for the Geometry.

return an integer value suitable for use as a hashcode

Definition Classes
Geometry -> Any
Inherited from
Geometry

Computes a <code>Geometry</code> representing the point-set which is common to both this <code>Geometry</code> and the <code>other</code> Geometry.

Computes a <code>Geometry</code> representing the point-set which is common to both this <code>Geometry</code> and the <code>other</code> 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 {link GeometryCollection}. If the result is empty, it is an atomic geometry with the dimension of the lowest input dimension.

Intersection of {link GeometryCollection}s is supported only for homogeneous collection types.

Non-empty heterogeneous {link GeometryCollection} arguments are not supported.

Value Params
other

the <code>Geometry</code> with which to compute the intersection return a Geometry representing the point-set common to the two <code>Geometry</code>s throws TopologyException if a robustness error occurs throws IllegalArgumentException if the argument is a non-empty heterogeneous <code>GeometryCollection</code>

Inherited from
Geometry
def intersects(g: Geometry): Boolean

Tests whether this geometry intersects the argument geometry.

Tests whether this geometry intersects the argument geometry.

The <code>intersects</code> predicate has the following equivalent definitions:

  • The two geometries have at least one point in common

  • The DE-9IM Intersection Matrix for the two geometries matches at least one of the patterns

  • <code>[T********]</code>

  • <code>[T******]</code>

  • <code>[T**]</code>

  • <code>[T]</code>

  • <code>! g.disjoint(this) = true</code> <br>(<code>intersects</code> is the inverse of <code>disjoint</code>)

Value Params
g

the <code>Geometry</code> with which to compare this <code>Geometry</code> return <code>true</code> if the two <code>Geometry</code>s intersect

See also

Geometry#disjoint

Inherited from
Geometry
override def isEmpty: Boolean
Definition Classes
Inherited from
GeometryCollection
def isRectangle: Boolean

Tests whether this is a rectangular {link Polygon}.

Tests whether this is a rectangular {link Polygon}.

return true if the geometry is a rectangle.

Inherited from
Geometry
def isSimple: Boolean

Tests whether this {link Geometry} is simple. The SFS definition of simplicity follows the general rule that a Geometry is simple if it has no points of self-tangency, self-intersection or other anomalous points.

Tests whether this {link Geometry} is simple. The SFS definition of simplicity follows the general rule that a Geometry is simple if it has no points of self-tangency, self-intersection or other anomalous points.

Simplicity is defined for each {link Geometry} subclass as follows:

  • Valid polygonal geometries are simple, since their rings must not self-intersect. <code>isSimple</code> tests for this condition and reports <code>false</code> if it is not met. (This is a looser test than checking for validity).

  • Linear rings have the same semantics.

  • Linear geometries are simple iff they do not self-intersect at points other than boundary points.

  • Zero-dimensional geometries (points) are simple iff they have no repeated points.

  • Empty <code>Geometry</code>s are always simple.

return <code>true</code> if this <code>Geometry</code> is simple

See also

#isValid

Inherited from
Geometry
def isValid: Boolean

Tests whether this <code>Geometry</code> is topologically valid, according to the OGC SFS specification.

Tests whether this <code>Geometry</code> is topologically valid, according to the OGC SFS specification.

For validity rules see the Javadoc for the specific Geometry subclass.

return <code>true</code> if this <code>Geometry</code> is valid

See also

IsValidOp

Inherited from
Geometry
def isWithinDistance(geom: Geometry, distance: Double): Boolean

Tests whether the distance from this <code>Geometry</code> to another is less than or equal to a specified value.

Tests whether the distance from this <code>Geometry</code> to another is less than or equal to a specified value.

Value Params
distance

the distance value to compare return <code>true</code> if the geometries are less than <code>distance</code> apart.

geom

the Geometry to check the distance to

Inherited from
Geometry

Creates a new Geometry which is a normalized copy of this Geometry.

Creates a new Geometry which is a normalized copy of this Geometry.

return a normalized copy of this geometry.

See also

#normalize()

Inherited from
Geometry
override def normalize(): Unit
Definition Classes
Inherited from
GeometryCollection
def overlaps(g: Geometry): Boolean

Tests whether this geometry overlaps the specified geometry.

Tests whether this geometry overlaps the specified geometry.

The <code>overlaps</code> predicate has the following equivalent definitions:

  • The geometries have at least one point each not shared by the other (or equivalently neither covers the other), they have the same dimension, and the intersection of the interiors of the two geometries has the same dimension as the geometries themselves.

  • The DE-9IM Intersection Matrix for the two geometries matches <code>[TTT]</code> (for two points or two surfaces) or <code>[1TT]</code> (for two curves)

If the geometries are of different dimension this predicate returns <code>false</code>. This predicate is symmetric.

Value Params
g

the <code>Geometry</code> with which to compare this <code>Geometry</code> return <code>true</code> if the two <code>Geometry</code>s overlap.

Inherited from
Geometry

Returns the DE-9IM {link IntersectionMatrix} for the two <code>Geometry</code>s.

Returns the DE-9IM {link IntersectionMatrix} for the two <code>Geometry</code>s.

Value Params
g

the <code>Geometry</code> with which to compare this <code>Geometry</code> return an { @link IntersectionMatrix} describing the intersections of the interiors, boundaries and exteriors of the two <code>Geometry</code>s

Inherited from
Geometry
def relate(g: Geometry, intersectionPattern: String): Boolean

Tests whether the elements in the DE-9IM {link IntersectionMatrix} for the two <code>Geometry</code>s match the elements in <code>intersectionPattern</code>. The pattern is a 9-character string, with symbols drawn from the following set:

Tests whether the elements in the DE-9IM {link IntersectionMatrix} for the two <code>Geometry</code>s match the elements in <code>intersectionPattern</code>. The pattern is a 9-character string, with symbols drawn from the following set:

<UL> <LI> 0 (dimension 0) <LI> 1 (dimension 1) <LI> 2 (dimension 2) <LI> T ( matches 0, 1 or 2) <LI> F ( matches FALSE) <LI> * ( matches any value) </UL> For more information on the DE-9IM, see the <i>OpenGIS Simple Features Specification</i>.

Value Params
g

the <code>Geometry</code> with which to compare this <code>Geometry</code>

intersectionPattern

the pattern against which to check the intersection matrix for the two <code>Geometry</code>s return <code>true</code> if the DE-9IM intersection matrix for the two <code>Geometry</code>s match <code>intersectionPattern</code>

See also

IntersectionMatrix

Inherited from
Geometry
def setSRID(SRID: Int): Unit

Sets the ID of the Spatial Reference System used by the <code>Geometry</code>.

Sets the ID of the Spatial Reference System used by the <code>Geometry</code>.

<b>NOTE:</b> This method should only be used for exceptional circumstances or for backwards compatibility. Normally the SRID should be set on the {link GeometryFactory} used to create the geometry. SRIDs set using this method will <i>not</i> be propagated to geometries returned by constructive methods.

See also

GeometryFactory

Inherited from
Geometry
def setUserData(userData: AnyRef): Unit

A simple scheme for applications to add their own custom data to a Geometry. An example use might be to add an object representing a Coordinate Reference System.

A simple scheme for applications to add their own custom data to a Geometry. An example use might be to add an object representing a Coordinate Reference System.

Note that user data objects are not present in geometries created by construction methods.

Value Params
userData

an object, the semantics for which are defined by the application using this Geometry

Inherited from
Geometry

Computes a <code>Geometry </code> representing the closure of the point-set which is the union of the points in this <code>Geometry</code> which are not contained in the <code>other</code> Geometry, with the points in the <code>other</code> Geometry not contained in this <code>Geometry</code>. If the result is empty, it is an atomic geometry with the dimension of the highest input dimension.

Computes a <code>Geometry </code> representing the closure of the point-set which is the union of the points in this <code>Geometry</code> which are not contained in the <code>other</code> Geometry, with the points in the <code>other</code> Geometry not contained in this <code>Geometry</code>. If the result is empty, it is an atomic geometry with the dimension of the highest input dimension.

Non-empty {link GeometryCollection} arguments are not supported.

Value Params
other

the <code>Geometry</code> with which to compute the symmetric difference return a Geometry representing the point-set symmetric difference of this <code>Geometry</code> with <code>other</code> throws TopologyException if a robustness error occurs throws IllegalArgumentException if either input is a non-empty GeometryCollection

Inherited from
Geometry
override def toString: String
Definition Classes
Geometry -> Any
Inherited from
Geometry
def touches(g: Geometry): Boolean

Tests whether this geometry touches the argument geometry.

Tests whether this geometry touches the argument geometry.

The <code>touches</code> predicate has the following equivalent definitions:

  • The geometries have at least one point in common, but their interiors do not intersect.

  • The DE-9IM Intersection Matrix for the two geometries matches at least one of the following patterns

  • <code>[FT*******]</code>

  • <code>[FT***]</code>

  • <code>[F*T**]</code>

If both geometries have dimension 0, the predicate returns <code>false</code>, since points have only interiors. This predicate is symmetric.

Value Params
g

the <code>Geometry</code> with which to compare this <code>Geometry</code> return <code>true</code> if the two <code>Geometry</code>s touch; Returns <code>false</code> if both <code>Geometry</code>s are points

Inherited from
Geometry

Computes the union of all the elements of this geometry.

Computes the union of all the elements of this geometry.

This method supports {link GeometryCollection}s (which the other overlay operations currently do not).

The result obeys the following contract:

  • Unioning a set of {link LineString}s has the effect of fully noding and dissolving the linework.

  • Unioning a set of {link Polygon}s always returns a {link Polygonal} geometry (unlike {link #union(Geometry)}, which may return geometries of lower dimension if a topology collapse occurred).

return the union geometry throws TopologyException if a robustness error occurs

See also

UnaryUnionOp

Inherited from
Geometry
def union(other: Geometry): Geometry

Computes a <code>Geometry</code> representing the point-set which is contained in both this <code>Geometry</code> and the <code>other</code> Geometry.

Computes a <code>Geometry</code> representing the point-set which is contained in both this <code>Geometry</code> and the <code>other</code> 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 {link GeometryCollection}. If the result is empty, it is an atomic geometry with the dimension of the highest input dimension.

Unioning {link LineString}s has the effect of <b>noding</b> and <b>dissolving</b> 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 <b>merged</b> linework is required, the {link LineMerger} class can be used.

Non-empty {link GeometryCollection} arguments are not supported.

Value Params
other

the <code>Geometry</code> with which to compute the union return a point-set combining the points of this <code>Geometry</code> and the points of <code>other</code> throws TopologyException if a robustness error occurs throws IllegalArgumentException if either input is a non-empty GeometryCollection

See also

LineMerger

Inherited from
Geometry
def within(g: Geometry): Boolean

Tests whether this geometry is within the specified geometry.

Tests whether this geometry is within the specified geometry.

The <code>within</code> predicate has the following equivalent definitions:

  • Every point of this geometry is a point of the other geometry, and the interiors of the two geometries have at least one point in common.

  • The DE-9IM Intersection Matrix for the two geometries matches <code>[TFF]</code>

  • <code>g.contains(this) = true</code> <br>(<code>within</code> is the converse of {link #contains})

An implication of the definition is that "The boundary of a Geometry is not within the Geometry". In other words, if a geometry A is a subset of the points in the boundary of a geometry B, <code>A.within(B) = false</code> (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 {link #coveredBy}.

Value Params
g

the <code>Geometry</code> with which to compare this <code>Geometry</code> return <code>true</code> if this <code>Geometry</code> is within <code>g</code>

See also

Geometry#contains

Geometry#coveredBy

Inherited from
Geometry

Concrete fields

override val factory: GeometryFactory
val polygons: Array[Polygon]

Inherited fields

var geometries: Array[Geometry]
Inherited from
GeometryCollection