diff --git a/GeoSpatialTools/octtree.py b/GeoSpatialTools/octtree.py index 00299867ac405ed8219cd644dce7b4edb299beb8..2a8bc2a8e83f73c6504315ecabd95a9ac4414b4c 100644 --- a/GeoSpatialTools/octtree.py +++ b/GeoSpatialTools/octtree.py @@ -224,8 +224,14 @@ class SpaceTimeRectangle: # Other is fully south of self return False # Handle east / west edges - return self._test_east_west(other.west) or self._test_east_west( - other.east + return ( + self._test_east_west(other.west) + or self._test_east_west(other.east) + # Fully contained within other + or ( + other._test_east_west(self.west) + and other._test_east_west(self.east) + ) ) def nearby( diff --git a/GeoSpatialTools/quadtree.py b/GeoSpatialTools/quadtree.py index 1bf7e7d40f84786238e6a2ba11e8300ba8181c12..dc26f844d3c9101a2b194b416a9d772a7b42339b 100644 --- a/GeoSpatialTools/quadtree.py +++ b/GeoSpatialTools/quadtree.py @@ -192,8 +192,14 @@ class Rectangle: # Other is fully south of self return False # Handle east / west edges - return self._test_east_west(other.west) or self._test_east_west( - other.east + return ( + self._test_east_west(other.west) + or self._test_east_west(other.east) + # Fully contained within other + or ( + other._test_east_west(self.west) + and other._test_east_west(self.east) + ) ) def nearby(