## com.vividsolutions.jts.index
Class PreparedGeometryIndex

    java.lang.Object
      com.vividsolutions.jts.index.PreparedGeometryIndex

    public class PreparedGeometryIndex

extends java.lang.Object

An index for `Geometry`s which provides efficient execution of queries involving spatial predicates. Query methods return the `Geometry` items in the index which have the specified relationship to the query `Geometry`. Internally the index uses `PreparedGeometry`s to provide performant evaluation of spatial predicates.

A common need is to maintain identifying information for the Geometrys in the index. This can be accomplished by either

- using the `UserData` field of the indexed Geometrys, or
- utilizing an external `HashMap`

Author:
  Martin Davis

Constructor Summary
`PreparedGeometryIndex()` Creates a new index object.

Method Summary
`void` `insert(java.util.Collection geoms)` Inserts a collection of `Geometry`s into the index.
`void` `insert(Geometry geom)` Inserts a `Geometry` into the index.
`void` `insertElements(GeometryCollection geomColl)` Inserts the atomic elements of a `GeometryCollection` into the index.
`java.util.List` `query(Envelope env)` Queries the index to find all items which might interact with the query target.
`java.util.List` `queryContains(Geometry g)` Queries the index to find all `Geometry`s which `contain` the query geometry.
`java.util.List` `queryCoveredBy(Geometry g)` Queries the index to find all `Geometry`s which are `coveredBy` the query geometry.
`java.util.List` `queryCovers(Geometry g)` Queries the index to find all `Geometry`s which `cover` the query geometry.
`java.util.List` `queryIntersects(Geometry g)` Queries the index to find all `Geometry`s which `intersect` the query geometry.
`java.util.List` `queryWithin(Geometry g)` Queries the index to find all `Geometry`s which are `within` the query geometry.
`void` `remove(Geometry geom)` Removes the given `Geometry` from the index.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PreparedGeometryIndex

    public PreparedGeometryIndex()

  Creates a new index object.

Method Detail

### insertElements

    public void insertElements(GeometryCollection geomColl)

  Inserts the atomic elements of a `GeometryCollection` into the index.

  Parameters:
    `geomColl` - a collection of Geometrys to insert

### insert

    public void insert(java.util.Collection geoms)

  Inserts a collection of `Geometry`s into the index.

  Parameters:
    `geoms` - a collection of Geometrys to insert

### insert

    public void insert(Geometry geom)

  Inserts a `Geometry` into the index.

  Parameters:
    `geom` - a collection of Geometrys to insert

### remove

    public void remove(Geometry geom)

  Removes the given `Geometry` from the index.

  Parameters:
    `geom` - the Geometry to remove

### query

    public java.util.List query(Envelope env)

  Queries the index to find all items which might interact with the query target.

  Parameters:
    `env` - the target envelope to query
  Returns:
    a List of candidate PreparedGeometrys

### queryContains

    public java.util.List queryContains(Geometry g)

  Queries the index to find all `Geometry`s which `contain` the query geometry.

  Parameters:
    `g` -
  Returns:
    a list of geometries that `intersect` the query geometry

### queryCoveredBy

    public java.util.List queryCoveredBy(Geometry g)

  Queries the index to find all `Geometry`s which are `coveredBy` the query geometry.

  Parameters:
    `g` -
  Returns:
    a list of geometries that `intersect` the query geometry

### queryCovers

    public java.util.List queryCovers(Geometry g)

  Queries the index to find all `Geometry`s which `cover` the query geometry.

  Parameters:
    `g` -
  Returns:
    a list of geometries that `intersect` the query geometry

### queryIntersects

    public java.util.List queryIntersects(Geometry g)

  Queries the index to find all `Geometry`s which `intersect` the query geometry.

  Parameters:
    `g` -
  Returns:
    a list of geometries that `intersect` the query geometry

### queryWithin

    public java.util.List queryWithin(Geometry g)

  Queries the index to find all `Geometry`s which are `within` the query geometry.

  Parameters:
    `g` -
  Returns:
    a list of geometries that intersect the query geometry