qdrant/qdrant

Geo Bounding Box Antimeridian Failure

Opened this issue · 0 comments

When a bounding box crosses the 180 meridian line, the simple check_point implementation fails.

Current Behavior + Steps to Reproduce

We noticed this error for user queries where "USA" was predicted as a location filter constraint from user input.

We use Google Maps geocoding API. In Qdrant's top-left / bottom-right syntax:

((74.071028, 167), (18.7763, -66.885417))

Here is the current logic:

impl GeoBoundingBox {
    pub fn check_point(&self, point: &GeoPoint) -> bool {
        (self.top_left.lon < point.lon)
            && (point.lon < self.bottom_right.lon)
            && (self.bottom_right.lat < point.lat)
            && (point.lat < self.top_left.lat)
    }
}

Consider this GPS coordinate in Los Angeles, CA:

(34.010714, -118.232922) 

This will fail because 167 is not less than -118.232922.

Expected Behavior

This should return True, Los Angeles is within this bounding box.

Possible Solution

The situation of a bounding box crossing the antimeridian requires special handling. I will open a PR with a fix.