Class SearchUsingPreparedGeometryIndex


  • public class SearchUsingPreparedGeometryIndex
    extends java.lang.Object
    Demonstrates use of PreparedGeometrys 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
    • Constructor Detail

      • SearchUsingPreparedGeometryIndex

        public SearchUsingPreparedGeometryIndex()
    • Method Detail

      • main

        public static void main​(java.lang.String[] args)
                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • runBruteForceQuery

        static int runBruteForceQuery​(java.util.Collection geoms)
      • area

        static double area​(java.util.Collection geoms)
      • createCircleGrid

        static java.util.List createCircleGrid​(int gridSize)
      • createRandomPoint

        static Point createRandomPoint()
      • findIntersecting

        static java.util.List findIntersecting​(java.util.Collection targetGeoms,
                                               Geometry queryGeom)