Class SearchUsingPreparedGeometryIndex
- java.lang.Object
-
- org.locationtech.jtsexample.technique.SearchUsingPreparedGeometryIndex
-
public class SearchUsingPreparedGeometryIndex extends java.lang.ObjectDemonstrates use ofPreparedGeometrys 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 GeometryFactorygeomFact(package private) static intGRID_SIZE(package private) static intMAX_ITER(package private) static intPOLYGON_SIZE
-
Constructor Summary
Constructors Constructor Description SearchUsingPreparedGeometryIndex()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static doublearea(java.util.Collection geoms)(package private) static GeometrycreateCircle(Coordinate centre, double radius)(package private) static java.util.ListcreateCircleGrid(int gridSize)(package private) static PointcreateRandomPoint()(package private) static java.util.ListfindIntersecting(java.util.Collection targetGeoms, Geometry queryGeom)static voidmain(java.lang.String[] args)(package private) static intrunBruteForceQuery(java.util.Collection geoms)(package private) static intrunIndexedQuery(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)
-
-