stac-utils / stac-utils/pgstac
Topology exception when fetching tiles via titiler-pgstac
Nobody has claimed this yet.
- Dominant language
- PLpgSQL
- Stars
- 223
- Forks
- 57
- PR merge metrics
- No merged PRs in 30d
Description
I'm seeing this topology exception happening in the tile server sporadically, which is causing some dropped tiles for mosaics, e.g.:
{
"detail": "lwgeom_intersection_prec: GEOS Error: TopologyException: Input geom 1 is invalid: Self-intersection at or near point -157.1336 21.707504790000002 at -157.1336 21.707504790000002\nCONTEXT: PL/pgSQL function geometrysearch(geometry,text,jsonb,integer,integer,interval,boolean,boolean) line 95 at assignment\nSQL function \"geojsonsearch\" statement 1"
}
That error was during the construction of this image, which is comprised of a set of tiles requested from titiler-pgstac:

The gray boxes are where 500's were thrown, including the one from the tile URL above.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failing tile request and tracing the PostgreSQL error through geometrysearch at line 95 and the geojsonsearch SQL function. Inspect how the tile query handles the invalid geometry reported in the error; done means the affected mosaic tile requests no longer sporadically return 500 errors.
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
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100