Class SearchUsingPreparedGeometryIndex
- java.lang.Object
-
- org.locationtech.jtsexample.technique.SearchUsingPreparedGeometryIndex
-
public class SearchUsingPreparedGeometryIndex extends java.lang.Object
Demonstrates use ofPreparedGeometry
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
Fields Modifier and Type Field 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 Summary
Constructors Constructor Description SearchUsingPreparedGeometryIndex()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method 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)
-
-
-
Field Detail
-
geomFact
static GeometryFactory geomFact
-
MAX_ITER
static final int MAX_ITER
- See Also:
- Constant Field Values
-
GRID_SIZE
static final int GRID_SIZE
- See Also:
- Constant Field Values
-
POLYGON_SIZE
static final int POLYGON_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception
- Throws:
java.lang.Exception
-
runIndexedQuery
static int runIndexedQuery(PreparedGeometryIndex pgIndex)
-
runBruteForceQuery
static int runBruteForceQuery(java.util.Collection geoms)
-
area
static double area(java.util.Collection geoms)
-
createCircleGrid
static java.util.List createCircleGrid(int gridSize)
-
createCircle
static Geometry createCircle(Coordinate centre, double radius)
-
createRandomPoint
static Point createRandomPoint()
-
findIntersecting
static java.util.List findIntersecting(java.util.Collection targetGeoms, Geometry queryGeom)
-
-