Class IntersectionIndex.Options

java.lang.Object
nz.org.riskscape.engine.geo.IntersectionIndex.Options
Enclosing class:
IntersectionIndex

public static class IntersectionIndex.Options extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
     
    boolean
     
    long
    Any geometries with more points than this is too complex
    double
    Any geometries with more than cutMinPoints is too complex if the ratio of their area to their bounding box is less than cutRatio.
    long
    Any geometries with more points than this and a larger cutRatio is too complex
    long
    An optional width/height to target for complexity.
    int
     
    boolean
    Whether to optimize this index by cutting up complex geometries for faster point lookups.
    boolean
    isTooComplex(org.locationtech.jts.geom.Geometry geom, org.locationtech.jts.geom.Envelope geomEnvelope)
    Heuristic for deciding if geometry is 'too complex' to put in the index.
    void
    setCutBeforeAdding(boolean cutBeforeAdding)
    Whether to optimize this index by cutting up complex geometries for faster point lookups.
    void
    setCutPoints(long cutPoints)
    Any geometries with more points than this is too complex
    void
    setCutRatio(double cutRatio)
    Any geometries with more than cutMinPoints is too complex if the ratio of their area to their bounding box is less than cutRatio.
    void
    setCutRatioPoints(long cutRatioPoints)
    Any geometries with more points than this and a larger cutRatio is too complex
    void
    setCutSizeMapUnits(long cutSizeMapUnits)
    An optional width/height to target for complexity.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Options

      public Options()
  • Method Details

    • isTooComplex

      public boolean isTooComplex(org.locationtech.jts.geom.Geometry geom, org.locationtech.jts.geom.Envelope geomEnvelope)

      Heuristic for deciding if geometry is 'too complex' to put in the index. We use this to decide whether to cut it up before adding it (as well as computing the true intersection for points later)

    • isCutBeforeAdding

      public boolean isCutBeforeAdding()

      Whether to optimize this index by cutting up complex geometries for faster point lookups. This optimization cuts up the indexed geometry recursively in to quads, until all the constituent parts are no longer "too complex" according to the indexes given options. Note that this option can have a slight detrimental affect on the performance of sampling polygonal features against the index.

      This improves performance by excluding large areas of these indexed geometries before they go in to the index, so that each feature's indexed "hitbox" is smaller, meaning less false positives in the index. This reduces the number of times the index returns a hit, only for the later, more computationally expensive, intersection test to fail.

      As a further optimization, point intersections can be done against the cut geometry, instead of the larger source geometry, which runs quicker against smaller (in terms of points) features.

      This feature will increase the amount of memory used by the index. Tuning the other options may help reach a compromise between memory usage and performance - the defaults are meant to be a good compromise.

    • getCutPoints

      public long getCutPoints()

      Any geometries with more points than this is too complex

    • getCutRatioPoints

      public long getCutRatioPoints()

      Any geometries with more points than this and a larger cutRatio is too complex

    • getCutRatio

      public double getCutRatio()

      Any geometries with more than cutMinPoints is too complex if the ratio of their area to their bounding box is less than cutRatio. This is a measure of the 'efficiency' of the bounding box as an index key; The higher the ratio, the more chance that a bounding box hit will also intersect with the indexed geometry.

    • getCutSizeMapUnits

      public long getCutSizeMapUnits()

      An optional width/height to target for complexity. When this option is set, this takes precedence over all other options. It defines the size of the geometry as being the (width + height) / 2. Note that it won't do any reprojection if your geometries are not metric.

    • setCutBeforeAdding

      public void setCutBeforeAdding(boolean cutBeforeAdding)

      Whether to optimize this index by cutting up complex geometries for faster point lookups. This optimization cuts up the indexed geometry recursively in to quads, until all the constituent parts are no longer "too complex" according to the indexes given options. Note that this option can have a slight detrimental affect on the performance of sampling polygonal features against the index.

      This improves performance by excluding large areas of these indexed geometries before they go in to the index, so that each feature's indexed "hitbox" is smaller, meaning less false positives in the index. This reduces the number of times the index returns a hit, only for the later, more computationally expensive, intersection test to fail.

      As a further optimization, point intersections can be done against the cut geometry, instead of the larger source geometry, which runs quicker against smaller (in terms of points) features.

      This feature will increase the amount of memory used by the index. Tuning the other options may help reach a compromise between memory usage and performance - the defaults are meant to be a good compromise.

    • setCutPoints

      public void setCutPoints(long cutPoints)

      Any geometries with more points than this is too complex

    • setCutRatioPoints

      public void setCutRatioPoints(long cutRatioPoints)

      Any geometries with more points than this and a larger cutRatio is too complex

    • setCutRatio

      public void setCutRatio(double cutRatio)

      Any geometries with more than cutMinPoints is too complex if the ratio of their area to their bounding box is less than cutRatio. This is a measure of the 'efficiency' of the bounding box as an index key; The higher the ratio, the more chance that a bounding box hit will also intersect with the indexed geometry.

    • setCutSizeMapUnits

      public void setCutSizeMapUnits(long cutSizeMapUnits)

      An optional width/height to target for complexity. When this option is set, this takes precedence over all other options. It defines the size of the geometry as being the (width + height) / 2. Note that it won't do any reprojection if your geometries are not metric.

    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object