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

AOI coordinates outside the -180,180 range cause the /search api to return no features. #732

Closed
danielfdsilva opened this issue Nov 2, 2023 · 2 comments

Comments

@danielfdsilva
Copy link
Collaborator

FROM: #726 (comment)

On the Exploration page, when the map is zoomed to the point where there are multiple world copies, it is possible to draw an AOI on a map that falls outside the -180,180 range.

In the image below, we can see 3 "full maps", each with its own coordinate range. Since I drew the AOI in the leftmost one, the API will return 0 features.

Screenshot 2023-11-02 at 19 27 03

The following payload will cause 0 features to be returned on a POST https://test-stac.delta-backend.com/search

View JSON Payload

{
    "filter-lang": "cql2-json",
    "limit": 10000,
    "fields": {
        "include": [
            "assets.cog_default.href",
            "properties.start_datetime",
            "properties.datetime"
        ],
        "exclude": [
            "collection",
            "links"
        ]
    },
    "filter": {
        "op": "and",
        "args": [
            {
                "op": "t_intersects",
                "args": [
                    {
                        "property": "datetime"
                    },
                    {
                        "interval": [
                            "2020-01-03T00:00:00.000Z",
                            "2021-01-24T23:59:59.999Z"
                        ]
                    }
                ]
            },
            {
                "op": "s_intersects",
                "args": [
                    {
                        "property": "geometry"
                    },
                    {
                        "type": "MultiPolygon",
                        "coordinates": [
                            [
                                [
                                    [
                                        -200,
                                        50
                                    ],
                                    [
                                        -200,
                                        10
                                    ],
                                    [
                                        -240,
                                        10
                                    ],
                                    [
                                        -240,
                                        50
                                    ],
                                    [
                                        -200,
                                        50
                                    ]
                                ]
                            ]
                        ]
                    }
                ]
            },
            {
                "op": "in",
                "args": [
                    {
                        "property": "collection"
                    },
                    [
                        "no2-monthly"
                    ]
                ]
            }
        ]
    }
}

This becomes all the more problematic when the AOI crosses into another map, which is very possible if the users' AIO is over the pacific ocean.

A solution would be to cut the polygons and then bring the part that is "outside" the map into the correct range. In this way we'd be submitting the correct payload.

However, is this something that the API should handle? Should it be able to handle coordinates outside the -180,180 range? (Not sure who's the best person to tag here. @anayeaye @smohiudd @ividito)

@j08lue
Copy link
Contributor

j08lue commented Nov 2, 2023

Btw - if you wonder why this is coming up now (the issue has been there all along): Users have a much bigger map to draw AOIs on, in the new Exploration & Analysis page, so the risk is greater that they draw outside the -180,180 range.

@j08lue
Copy link
Contributor

j08lue commented Nov 14, 2023

Fixed in #734

@j08lue j08lue closed this as completed Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants