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

[Utility] International dateline check for bbox #39

Closed
cbeddow opened this issue Jul 8, 2021 · 3 comments
Closed

[Utility] International dateline check for bbox #39

cbeddow opened this issue Jul 8, 2021 · 3 comments
Assignees
Labels
feature A feature request for the SDK good first issue Good for newcomers utility

Comments

@cbeddow
Copy link
Member

cbeddow commented Jul 8, 2021

Is your feature request related to a problem? Please describe.
Related to #27

If a bounding box crosses the international dateline, then checking if an image/map feature point falls inside the bbox could fail.

For example if the bbox of [west,south,east,north] is: [174.375,-20.879342971957897,-169.5849609375,-11.566143767762844]

And a point is located at: (178.5498046875,-17.936928637549432)

Then the longitude of 178.54 will be > the west value longitude of 174.37 but also > the east value of -169.5849609375

Then it would return as false for a check to see if it is inside a bbox. It should be < the east value to pass the check.

If the west is a negative and the east is a positive, there is not a problem, only the inverse where west is positive and east is negative.

Describe the solution you'd like
We should do a dateline check, like:

bbox =  [west,south,east,north]  # these should be int values, using names for example here
if west is a positive number and east is a negative value:
    new_east = east + 360
    bbox = [west,south,new_east,north]

Describe alternatives you've considered
Considered generating a linestring geometry representing the dateline/antemeridian and checking if the bbox geometry intersects it, but this is a more expensive computation

Additional context
The issue here over is that the dateline is where the +/-180 degrees of a sphere "resets" from positive to negative, which can break out bbox check

@cbeddow
Copy link
Member Author

cbeddow commented Aug 18, 2021

We could move this to be a good first issue

@Rubix982 Rubix982 added the good first issue Good for newcomers label Aug 18, 2021
@Rubix982
Copy link
Contributor

Done!

@Rubix982
Copy link
Contributor

This was solved in #116

@OmarMuhammedAli OmarMuhammedAli moved this from To do to Done in MLH Fellowship Dec 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A feature request for the SDK good first issue Good for newcomers utility
Projects
Development

No branches or pull requests

3 participants