Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geo Bounding Box Antimeridian Failure #4102

Open
almostimplemented opened this issue Apr 24, 2024 · 0 comments
Open

Geo Bounding Box Antimeridian Failure #4102

almostimplemented opened this issue Apr 24, 2024 · 0 comments
Labels
bug Something isn't working to be released Ready to be released issue

Comments

@almostimplemented
Copy link
Contributor

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.

@almostimplemented almostimplemented added the bug Something isn't working label Apr 24, 2024
@generall generall added the to be released Ready to be released issue label Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working to be released Ready to be released issue
Projects
None yet
Development

No branches or pull requests

2 participants