Spatial DataBlade
JAVA API v8.21

com.ibm.spatial.geom
Interface Geometry

All Known Subinterfaces:
Curve, GeometryCollection, LineString, MultiCurve, MultiLineString, MultiPoint, MultiPolygon, MultiSurface, Point, Polygon, Surface
All Known Implementing Classes:
IfxGeometry, IfxGeometryCollection, IfxLineString, IfxMultiCoord, IfxMultiLineString, IfxMultiPoint, IfxMultiPolygon, IfxPoint, IfxPolygon, IfxSurface

public interface Geometry

Geometry is the root in a hierarchy of interfaces encapsulating the abstract model of OpenGIS Simple Features Specification.

For simplicity reasons, the Geometry interface provide a minimum number of essential members. Particular implementations of Geometry may choose to implement just a subset of the methods defined here, or provide additional convenience methods.


Method Summary
 java.io.ByteArrayOutputStream asBinary()
          Exports this geometry to a specific well-known binary representation.
 java.lang.String asText()
          Exports this geometry to a specific well-known text representation.
 Geometry boundary()
          Returns the combined boundary of this geometry object.
 Geometry buffer(double distance)
          Generates a geometry by encircling this object at a specified distance.
 boolean contains(Geometry geometry)
          Returns whether or not this object completely contains the geometry argument.
 Geometry convexHull()
          Returns the convex hull of any geometry that has at least three vertices forming a convex.
 boolean crosses(Geometry geometry)
          Determines whether this geometry crosses the argument geometry.
 Geometry difference(Geometry geometry)
          Returns the portion of this geometry that is not intersected by the argument geometry - the logical AND NOT of space.
 int dimension()
          Returns the dimension of this geometry object.
 boolean disjoint(Geometry geometry)
          Returns whether this geometry does not intersect, overlap, or touch the argument geometry.
 double distance(Geometry geometry)
          Returns the shortest distance separating this geometry from the argument.
 Geometry envelope()
          Returns a Geometry that represents this object's envelope.
 boolean envelopesIntersect(Geometry geometry)
          Returns true if the envelope of this geometry object intersects the envelope of the argument.
 boolean equals(java.lang.Object geometry)
          Tests this geometry object for equality with the given object.
 Envelope extent()
          Returns an Envelope object that represents this geometry's envelope.
 Geometry exterior()
          Returns the exterior of a geometry, that is, all space not occupied by the geometry.
 Geometry interior()
          Returns the interior of a geometry, that is, the space occupied by the geometry.
 Geometry intersection(Geometry geometry)
          Returns the intersection set of this geometry object with the argument.
 boolean intersects(Geometry geometry)
          Tests this geometry object for intersection with the argument.
 boolean is3D()
          Tests whether or not this geometry object has three-dimensional coordinates.
 boolean isEmpty()
          Tests whether this geometry object is empty.
 boolean isMeasured()
          Tests whether or not this geometry object has measures.
 boolean isSimple()
          Tests whether this geometry object is simple (has no anomalous geometric points, such as self intersection or self tangency).
 boolean isValid()
          Tests for the validity of this object (the object obeys all the Simple Feature rules for its type).
 Geometry locateAlong(double measure)
          Takes a geometry object and a measure to return the set of points found having that measure.
 Geometry locateBetween(double fromMeasure, double toMeasure)
          Returns the points or line segments of the given geometry between the specified measure values (fromMeasure and toMeasure).
 int numPoints()
          Returns the number of points in this geometry.
 boolean overlaps(Geometry geometry)
          Determines whether the argument overlaps this geometry object.
 int srid()
          Returns this object's spatial reference system identity.
 Geometry symmetricDiff(Geometry geometry)
          Returns a geometry object that is composed of the parts of this object and the argument that aren't common to both.
 boolean touches(Geometry geometry)
          This geometry object touches the argument if and only if the interiors do not intersect and the boundary of either geometry intersects the other's interior or boundary.
 Geometry union(Geometry geometry)
          Returns the union set (the boolean logical OR of space) of this geometry object and the argument.
 boolean within(Geometry geometry)
          Tests whether this geometry object is completely within the argument geometry.
 

Method Detail

asText

java.lang.String asText()
Exports this geometry to a specific well-known text representation.

Returns:
The well-known text (WKT) representation of this geometry object.

asBinary

java.io.ByteArrayOutputStream asBinary()
Exports this geometry to a specific well-known binary representation.

Returns:
The well-known binary (WKB) representation of this geometry object.

boundary

Geometry boundary()

Returns the combined boundary of this geometry object.

The dimension of the resulting geometry is always one less than the input geometry. Points and MultiPoints always result in a boundary that is an empty geometry, dimension -1. Linestrings and MultiLinestrings return a multipoint boundary, dimension 0. A Polygon or MultiPolygon always returns a MultiLinestring boundary, dimension 1.

Returns:
The boundary of this object.

buffer

Geometry buffer(double distance)

Generates a geometry by encircling this object at a specified distance.

A single polygon results when a primary geometry is buffered or when the buffer polygons of a collection are close enough to overlap. When enough separation exists between the elements of a buffered collection, individual buffer polygons result in MultiPolygon object.

Buffer accepts both positive and negative distances, but only geometries with a dimension of 2 (Polygon and MultiPolygon) can apply a negative buffer. The absolute value of the buffer distance is used when the dimension of the source geometry is less than 2 (all geometries that are neither Polygon nor MultiPolygon). Generally speaking, positive buffer distances generate polygon rings that are away from the center of the source geometry, and for the exterior ring of a Polygon or MultiPolygon, toward the center when the distance is negative. For interior rings of a Polygon or MultiPolygon, the buffer ring is toward the center when the buffer distance is positive and away from the center when it is negative.

The buffering process merges buffer polygons that overlap. Negative distances greater than one-half the maximum interior width of a polygon result in an empty geometry.

Parameters:
distance - The distance at which the encircling geometry is generated.
Returns:
The buffer geometry.

contains

boolean contains(Geometry geometry)

Returns whether or not this object completely contains the geometry argument. The boundary and interior of the argument geometry are not allowed to intersect the exterior of this object.

This function returns the opposite result of within.

Parameters:
geometry - The geometry tested for inclusion.
Returns:
true if this Geometry contains the argument object; false otherwise.
See Also:
within(Geometry)

convexHull

Geometry convexHull()

Returns the convex hull of any geometry that has at least three vertices forming a convex.

Creating a convex hull is often the first step when tessellating a set of points to create a triangulated irregular network (TIN). If vertices of the geometry do not form a convex, convexHull returns null.

Returns:
The convex hull geometry.

crosses

boolean crosses(Geometry geometry)

Determines whether this geometry crosses the argument geometry. Returns true if their intersection results in a geometry object whose dimension is one less than the maximum dimension of the source objects.

The following pairs of geometries cross each other:

   MultiPoint and Polygon
   MultiPoint and LineString
   LineString and LineString
   LineString and Polygon
   LineString and MultiPolygon
 

Returns:
true if this Geometry crosses the argument object; false otherwise.

difference

Geometry difference(Geometry geometry)

Returns the portion of this geometry that is not intersected by the argument geometry - the logical AND NOT of space.

This function only operates on geometries of like dimension and returns a GeometryCollection that has the same dimension as the source geometries. In the event that the source geometries are equal, an empty geometry is returned.

Parameters:
geometry - The geometry tested for inclusion.
Returns:
The difference between this geometry and the argument.

dimension

int dimension()

Returns the dimension of this geometry object. A geometry can have one of three dimensions:

Returns:
The dimension of this geometry.

disjoint

boolean disjoint(Geometry geometry)
Returns whether this geometry does not intersect, overlap, or touch the argument geometry.

Parameters:
geometry - The geometry tested for non-intersection.
Returns:
true if this geometry does not intersect the argument geometry; otherwise, it returns false.
See Also:
intersects(com.ibm.spatial.geom.Geometry)

distance

double distance(Geometry geometry)
Returns the shortest distance separating this geometry from the argument.

Parameters:
geometry - The geometry to which the distance is calculated.
Returns:
The distance between this object and the argument.

envelope

Geometry envelope()

Returns a Geometry that represents this object's envelope.

The envelope of a geometry is the bounding geometry formed by the minimum and maximum (x,y) coordinates. The envelopes of most geometries form a boundary rectangle; however, the envelope of a point is the point itself, since its minimum and maximum coordinates are the same, and the envelope of a horizontal or vertical linestring is a linestring represented by the endpoints of the source linestring.

Returns:
The envelope of this object

extent

Envelope extent()

Returns an Envelope object that represents this geometry's envelope.

The envelope of a geometry is the bounding geometry formed by the minimum and maximum (x,y) coordinates. The envelopes of most geometries form a boundary rectangle; however, the envelope of a point is the point itself, since its minimum and maximum coordinates are the same, and the envelope of a horizontal or vertical linestring is a linestring represented by the endpoints of the source linestring.

Returns:
The envelope of this object

envelopesIntersect

boolean envelopesIntersect(Geometry geometry)
Returns true if the envelope of this geometry object intersects the envelope of the argument.

Parameters:
geometry - The geometry tested for envelope intersection
Returns:
true if this geometry's envelope intersects the envelope of the argument; otherwise, it returns false

equals

boolean equals(java.lang.Object geometry)
Tests this geometry object for equality with the given object. Two geometries are equal only if they have identical (x,y) coordinate values.

Overrides:
equals in class java.lang.Object
Parameters:
geometry - The object to be compared with this geometry
Returns:
true if and only if the objects are the same; false otherwise

intersects

boolean intersects(Geometry geometry)

Tests this geometry object for intersection with the argument.

Within the Dimensionally Extended 9 Intersection Model (DE-9IM), this function function returns true if and only if any of the following conditions are true:

Parameters:
geometry - The geometry tested for intersection
Returns:
true if the intersection of this geometry object and the argument doesn't result in an empty set; otherwise, returns false.

intersection

Geometry intersection(Geometry geometry)

Returns the intersection set of this geometry object with the argument. The intersection set is returned as a collection that is the minimum dimension of the source geometries. For example, for a LineString that intersects a Polygon, this function returns that portion of the LineString common to the interior and boundary of the Polygon as a MultiLineString. The MultiLineString contains more than one LineString if the source LineString intersects the Polygon with two or more discontinuous segments.

If the geometries do not intersect or if the intersection results in a dimension less than both source geometries, an empty geometry is returned.

Parameters:
geometry - The geometry to intersect with
Returns:
true if the intersection of this geometry

is3D

boolean is3D()
Tests whether or not this geometry object has three-dimensional coordinates.

Returns:
true if this object has three-dimensional coordinates; otherwise, returns false

isEmpty

boolean isEmpty()
Tests whether this geometry object is empty.

Returns:
true if this geometry object is empty; otherwise, returns false

isSimple

boolean isSimple()

Tests whether this geometry object is simple (has no anomalous geometric points, such as self intersection or self tangency).

For example, a LineString is simple if it does not intersect its interior. A MultiPoint is simple if none of its elements occupy the same coordinate space. A MultiLineString is simple if none of its element's interiors intersect.

Returns:
true if this geometry object is simple; otherwise, returns false

overlaps

boolean overlaps(Geometry geometry)

Determines whether the argument overlaps this geometry object.

Two geometries overlap if and only if their intersection results in a geometry object of the same dimension but not equal to either source object. In other words, if the intersection of two Polygon geometries results in a Polygon, then this function returns true.

Parameters:
geometry - The geometry to test for overlapping
Returns:
true if this geometry object and the argument overlap; otherwise, returns false

srid

int srid()
Returns this object's spatial reference system identity.

Returns:
The spatial reference ID of this geometry object.

numPoints

int numPoints()
Returns the number of points in this geometry.

Returns:
the number of points in this geometry

symmetricDiff

Geometry symmetricDiff(Geometry geometry)

Returns a geometry object that is composed of the parts of this object and the argument that aren't common to both.

The symmetric difference of two geometries is the logical XOR of space (the portions of the source geometries that are not part of the intersection set). The source geometries must have the same dimension. If the geometries are equal, this function returns an empty geometry; otherwise, it returns the result as a GeometryCollection.

Parameters:
geometry - The second operand of the symmetric difference
Returns:
A geometry representing the result of the symmetric difference operation

touches

boolean touches(Geometry geometry)

This geometry object touches the argument if and only if the interiors do not intersect and the boundary of either geometry intersects the other's interior or boundary. At least one geometry must be a LineString, Polygon, MultiLineString, or MultiPolygon.

Parameters:
geometry - The geometry to test for touching
Returns:
true if this geometry object and the argument touch; otherwise, returns false

union

Geometry union(Geometry geometry)
Returns the union set (the boolean logical OR of space) of this geometry object and the argument. The source geometries must have the same dimension. The result is returned as a GeometryCollection.

Parameters:
geometry - The second operand of the union
Returns:
Returns a geometry object that is the union of this object and the argument.

within

boolean within(Geometry geometry)
Tests whether this geometry object is completely within the argument geometry. The boundary and interior of this geometry are not allowed to intersect the exterior of the argument geometry. Within tests for the exact opposite result of contains.

Parameters:
geometry - The geometry to test for within
Returns:
true if this geometry object is completely within the argument; otherwise, returns false
See Also:
contains(Geometry)

isMeasured

boolean isMeasured()
Tests whether or not this geometry object has measures.

Returns:
true if this object has measures; otherwise, returns false

isValid

boolean isValid()

Tests for the validity of this object (the object obeys all the Simple Feature rules for its type).

The IBM Informix Spatial DataBlade validates spatial data before accepting it, Geometries returned as a result of SQL queries are always valid. This function may be used to validate spatial data supplied by other implementations of the OpenGIS spatial data specification.

Returns:
true if this geometry object is valid; otherwise, returns false

exterior

Geometry exterior()
Returns the exterior of a geometry, that is, all space not occupied by the geometry.

Returns:
the exterior of a geometry

interior

Geometry interior()
Returns the interior of a geometry, that is, the space occupied by the geometry.

Returns:
the interior of a geometry

locateAlong

Geometry locateAlong(double measure)
Takes a geometry object and a measure to return the set of points found having that measure.

Returns:
the set of points having the measure specified by measure

locateBetween

Geometry locateBetween(double fromMeasure,
                       double toMeasure)
Returns the points or line segments of the given geometry between the specified measure values (fromMeasure and toMeasure). The Geometry returned represents the set of disconnected points or paths between the two measure locations.

Returns:
the set of points or paths having measures between fromMeasure and toMeasure

Spatial DataBlade
JAVA API v8.21


Licensed Materials - Property of IBM
Copyright IBM Corp. 2002, 2012 All Rights Reserved.