public class SearchUsingPreparedGeometryIndex
extends java.lang.Object
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.Modifier and Type | Field and Description |
---|---|
(package private) static GeometryFactory |
geomFact |
(package private) static int |
GRID_SIZE |
(package private) static int |
MAX_ITER |
(package private) static int |
POLYGON_SIZE |
Constructor and Description |
---|
SearchUsingPreparedGeometryIndex() |
Modifier and Type | Method and Description |
---|---|
(package private) static double |
area(java.util.Collection geoms) |
(package private) static Geometry |
createCircle(Coordinate centre,
double radius) |
(package private) static java.util.List |
createCircleGrid(int gridSize) |
(package private) static Point |
createRandomPoint() |
(package private) static java.util.List |
findIntersecting(java.util.Collection targetGeoms,
Geometry queryGeom) |
static void |
main(java.lang.String[] args) |
(package private) static int |
runBruteForceQuery(java.util.Collection geoms) |
(package private) static int |
runIndexedQuery(PreparedGeometryIndex pgIndex) |
static GeometryFactory geomFact
static final int MAX_ITER
static final int GRID_SIZE
static final int POLYGON_SIZE
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
static int runIndexedQuery(PreparedGeometryIndex pgIndex)
static int runBruteForceQuery(java.util.Collection geoms)
static double area(java.util.Collection geoms)
static java.util.List createCircleGrid(int gridSize)
static Geometry createCircle(Coordinate centre, double radius)
static Point createRandomPoint()
static java.util.List findIntersecting(java.util.Collection targetGeoms, Geometry queryGeom)