org.apache.lucene.spatial.util

Class GeoRelationUtils

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static boolean pointInRectPrecise(double lat, double lon, double minLat, double maxLat, double minLon, double maxLon)
      Determine if a bbox (defined by minLat, maxLat, minLon, maxLon) contains the provided point (defined by lat, lon) NOTE: this is a basic method that does not handle dateline or pole crossing.
      static boolean rectCrosses(double aMinLat, double aMaxLat, double aMinLon, double aMaxLon, double bMinLat, double bMaxLat, double bMinLon, double bMaxLon)
      Computes whether two rectangles cross
      static boolean rectIntersects(double aMinLat, double aMaxLat, double aMinLon, double aMaxLon, double bMinLat, double bMaxLat, double bMinLon, double bMaxLon)
      Computes whether a rectangle intersects another rectangle (crosses, within, touching, etc)
      static boolean rectWithin(double aMinLat, double aMaxLat, double aMinLon, double aMaxLon, double bMinLat, double bMaxLat, double bMinLon, double bMaxLon)
      Computes whether the first (a) rectangle is wholly within another (b) rectangle (shared boundaries allowed)
    • Method Detail

      • pointInRectPrecise

        public static boolean pointInRectPrecise(double lat,
                                                 double lon,
                                                 double minLat,
                                                 double maxLat,
                                                 double minLon,
                                                 double maxLon)
        Determine if a bbox (defined by minLat, maxLat, minLon, maxLon) contains the provided point (defined by lat, lon) NOTE: this is a basic method that does not handle dateline or pole crossing. Unwrapping must be done before calling this method.
      • rectWithin

        public static boolean rectWithin(double aMinLat,
                                         double aMaxLat,
                                         double aMinLon,
                                         double aMaxLon,
                                         double bMinLat,
                                         double bMaxLat,
                                         double bMinLon,
                                         double bMaxLon)
        Computes whether the first (a) rectangle is wholly within another (b) rectangle (shared boundaries allowed)
      • rectCrosses

        public static boolean rectCrosses(double aMinLat,
                                          double aMaxLat,
                                          double aMinLon,
                                          double aMaxLon,
                                          double bMinLat,
                                          double bMaxLat,
                                          double bMinLon,
                                          double bMaxLon)
        Computes whether two rectangles cross
      • rectIntersects

        public static boolean rectIntersects(double aMinLat,
                                             double aMaxLat,
                                             double aMinLon,
                                             double aMaxLon,
                                             double bMinLat,
                                             double bMaxLat,
                                             double bMinLon,
                                             double bMaxLon)
        Computes whether a rectangle intersects another rectangle (crosses, within, touching, etc)