stac-utils / stac-utils/pgstac

Query with bbox crossing antimeridian does not work as expected

Open
#428 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PLpgSQL
Stars
223
Forks
57
PR merge metrics
No merged PRs in 30d

Description

I'm using pgstac indirectly via stac-fastapi-pgstac, where I experience the following problem (I originally opened the issue on the stac-fastapi-pgstac repository, but was suggested it could be better to address it in pgstac):

The description for the bbox query parameter in the item-search STAC API documentation states that

For WGS 84 longitude/latitude the values are in most cases the sequence of minimum longitude, minimum latitude, maximum longitude and maximum latitude. However, in cases where the box spans the antimeridian the first value (west-most box edge) is larger than the third value (east-most box edge).

From what I understand, I would say that a STAC compliant /search endpoint should allow specifying antimeridian-crossing bounding boxes simply by setting the first value greater than the third value, such as

/search?bbox=178,-45,-178,45

Anyway I see that such a request does not work as expected, behaving instead in the same way as

/search?bbox=-178,-45,178,45

How am I suppose (if that is possible at all) to submit antimeridian-crossing bbox query parameter?
And, if that is not possible with the current implementation of stac-fastapi-pgstac, wouldn't this make it not fully compliant with the STAC API specification?

System setting
  • stac-fastapi-pgstac: 6.1.0
  • pgstac: 0.9.8

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The payload names no implementation file or test; start by reproducing the /search?bbox=178,-45,-178,45 case in pgstac and compare it with the non-crossing example. Trace the bbox handling used by the search entry point, then verify that antimeridian-crossing and ordinary boxes return the distinct STAC-compliant result sets.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, sql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.