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

Is it possible to use multiple URL for a single PMTiles source? #491

Open
mabhub opened this issue Nov 7, 2024 · 5 comments
Open

Is it possible to use multiple URL for a single PMTiles source? #491

mabhub opened this issue Nov 7, 2024 · 5 comments

Comments

@mabhub
Copy link

mabhub commented Nov 7, 2024

Maybe related to #16

Currently in HTTP/1.1 browsers are limiting by domain how many (6) concurrent requests can be done.

Map frameworks like MapLibre, Mapbox, Leaflet (also according tilejson-spec) allow to define multiple URL for each source.
Also each (file)tiles providers usually provide multiple subdomain for the same content ([a|b|c].tile.thunderforest.com, [a|b|c].tile-cyclosm.openstreetmap.fr,…).
Thus allowing to bypass browsers limitation.

Is there such a way for PMTiles protocol adapter to accept multiple URL?

@bdon
Copy link
Member

bdon commented Nov 7, 2024

No - that solution relies on server-side aliasing of a,b,c. Does your storage platform for the PMTiles have that feature? It doesn't seem worth it to build such a server-side feature to work around the limitations of HTTP/1.1, so if your storage platform does not support HTTP2 you can use one of these proxies that all support HTTP/2: https://docs.protomaps.com/deploy/

@mabhub
Copy link
Author

mabhub commented Nov 7, 2024

Does your storage platform for the PMTiles have that feature?

Precisely! We already have a classic tile hosting infrastructure that handles subdomains.
And for PMTiles, we simply set up a reverse proxy in front of an S3 storage.

Since most map frameworks already handle the use of multiple tile URLs for each tile source, it might seem legitimate that the PMTiles protocol provides such a feature.

Could this be a feature request?

@bdon
Copy link
Member

bdon commented Nov 8, 2024

Why do you prefer this solution instead of HTTP/2?

@mabhub
Copy link
Author

mabhub commented Nov 14, 2024

It's not a matter of preference, but rather of keeping a functionality that is for now still available with default protocol.

If you think it shouldn't be possible, I won't insist further.

@bdon
Copy link
Member

bdon commented Nov 18, 2024

Since most map frameworks already handle the use of multiple tile URLs for each tile source

This is tied to the interpolation of {subdomain}/{z}/{x}/{y}.mvt templates though, right? Most of the developer-facing APIs here forgo the z/x/y templates for plain (non-templated) urls like https://example.com/name.pmtiles so we would need to turn such plain strings into templates as well like {subdomain}.example.com/name.pmtiles.

In order to take advantage of multiple subdomains you would then need a proxy in front of S3 storage, but if you are already using a proxy it seems like the vast majority of dynamic proxies like caddy, nginx or a zxy decoder all support HTTP/2 already.

So don't feel like this solution is general enough to be part of the JS implementation, but if other users disagree then it could be reconsidered.

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