Class SearchUsingPreparedGeometryIndex
java.lang.Object
org.locationtech.jtsexample.technique.SearchUsingPreparedGeometryIndex
Demonstrates use of
PreparedGeometry
s in a spatial index
to optimize spatial search.
The example creates a grid of circular polygons, packed into the 1 x 1 square.
This set of polygons is spatially indexed as PreparedGeometrys in an STRtree index.
A series of random points in the square is generated, and the index
is used to determine whether each point intersects any circles.
The fraction of points which intersect will approximate the
fraction of area covered by the circles.- Version:
- 1.12
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static GeometryFactory
(package private) static final int
(package private) static final int
(package private) static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static double
area
(Collection geoms) (package private) static Geometry
createCircle
(Coordinate centre, double radius) (package private) static List
createCircleGrid
(int gridSize) (package private) static Point
(package private) static List
findIntersecting
(Collection targetGeoms, Geometry queryGeom) static void
(package private) static int
runBruteForceQuery
(Collection geoms) (package private) static int
runIndexedQuery
(PreparedGeometryIndex pgIndex)
-
Field Details
-
geomFact
-
MAX_ITER
static final int MAX_ITER- See Also:
-
GRID_SIZE
static final int GRID_SIZE- See Also:
-
POLYGON_SIZE
static final int POLYGON_SIZE- See Also:
-
-
Constructor Details
-
SearchUsingPreparedGeometryIndex
public SearchUsingPreparedGeometryIndex()
-
-
Method Details
-
main
- Throws:
Exception
-
runIndexedQuery
-
runBruteForceQuery
-
area
-
createCircleGrid
-
createCircle
-
createRandomPoint
-
findIntersecting
-