Skip to content

Force a 404 code for tiles out of bounds#2365

Merged
tomkralidis merged 2 commits into
geopython:masterfrom
doublebyte1:mvt-proxy-500
Jun 20, 2026
Merged

Force a 404 code for tiles out of bounds#2365
tomkralidis merged 2 commits into
geopython:masterfrom
doublebyte1:mvt-proxy-500

Conversation

@doublebyte1

@doublebyte1 doublebyte1 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Overview

Related Issue / discussion

#2364

Additional information

On the mvt-proxy provider, we are not sure what the behaviour of the upstream server is regarding tiles out of bounds; however, we need to make sure that if the tile is out of bounds we return a 404. This PR forces that behaviour on mvt-proxy, by evaluating if the 500 error was caused by requesting a tile outside the limits of the TMS. This also ensures that we pass the conformance test.

curl -I localhost:5000/collections/srup_arvores_point/tiles/WebMercatorQuad/0/0/100?f=pbf
HTTP/1.1 404 NOT FOUND
Server: Werkzeug/3.1.8 Python/3.12.0
Date: Fri, 19 Jun 2026 12:58:03 GMT
Content-Type: application/vnd.mapbox-vector-tile
X-Powered-By: pygeoapi 0.24.dev0
Content-Language: en-US
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: *
Content-Length: 14
Connection: close

Screenshot from 2026-06-19 13-56-56

Dependency policy (RFC2)

  • I have ensured that this PR meets RFC2 requirements

Updates to public demo

Contributions and licensing

(as per https://github.com/geopython/pygeoapi/blob/master/CONTRIBUTING.md#contributions-and-licensing)

  • I'd like to contribute [feature X|bugfix Y|docs|something else] to pygeoapi. I confirm that my contributions to pygeoapi will be compatible with the pygeoapi license guidelines at the time of contribution
  • I have already previously agreed to the pygeoapi Contributions and Licensing Guidelines

@doublebyte1 doublebyte1 changed the title Force a 404 code for tiles out of bound Force a 404 code for tiles out of bounds Jun 19, 2026
@tomkralidis tomkralidis self-requested a review June 19, 2026 13:07
@tomkralidis tomkralidis added this to the 0.24.0 milestone Jun 19, 2026
@tomkralidis tomkralidis added bug Something isn't working OGC API - Tiles OGC API - Tiles labels Jun 19, 2026
Comment thread pygeoapi/provider/mvt_proxy.py Outdated
resp = session.get(f'{base_url}/{layer}/{z}/{x}/{y}{url_query}') # noqa

if resp.status_code == 404:
if resp.status_code == 404 or resp.status_code == 500:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we update to:

if resp.status_code in [404, 500]:

@doublebyte1 doublebyte1 requested a review from tomkralidis June 20, 2026 11:14
@tomkralidis tomkralidis merged commit 726e48b into geopython:master Jun 20, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working OGC API - Tiles OGC API - Tiles

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants