protomaps / PMTiles

Cloud-optimized + compressed single-file tile archives for vector and raster maps
https://protomaps.com/docs/pmtiles/
BSD 3-Clause "New" or "Revised" License
2.01k stars 118 forks source link

Self hosting #472

Open ethicnology opened 1 week ago

ethicnology commented 1 week ago

Hello, protomaps looks an amazing project but when it comes to self-hosting without using a listed provider or caddy there is not so much informations.

After using the command pmtiles serve and then trying to load the URL into pmtiles viewer it doesn't display anything (offset is outside the bounds of the DataView) while my logs display :

2024/10/05 12:54:13 main.go:154: served 204 %2F in 62.207µs
2024/10/05 12:54:30 main.go:154: served 204 %2F in 25.889µs
2024/10/05 12:55:02 main.go:154: served 204 %2F in 21.801µs
2024/10/05 12:55:36 main.go:154: served 204 %2F in 19.316µs
…

From pmtiles viewer I've tried, I'm serving --cors="*" 20241004.pmtiles:

bdon commented 1 week ago

the PMTiles viewer is designed for client-side decoding, if you are running pmtiles serve you can use any map renderer that supports ZXY urls like maputnik: http://maplibre.org/maputnik/

but I understand it may be convenient to view those: #286

without using a listed provider or caddy there is not so much informations.

What information would be helpful in addition to these?

https://docs.protomaps.com/pmtiles/cli#serve https://docs.protomaps.com/deploy/server

ethicnology commented 1 week ago

Thank you for your time and quick answer.

I guess once we use the command pmtiles serve what we want is to try the setup.

For example, I tried maputnik but I can't do much, I tried to open various URL on my self-hosted and then from protomaps api, they all fail.

https://api.protomaps.com/tiles/v3.json?key=with_my_key
https://api.protomaps.com/tiles/v3/{z}/{x}/{y}.mvt?key=with_my_key

I also tried to use .png because most libraries are compatible with this format but it doesn't seems to work either.

bdon commented 6 days ago

I tried maputnik but I can't do much

You need to add it as a TileJSON (vector) source

https://api.protomaps.com/tiles/v3.json?key=with_my_key

did you allow the CORS origin https://maplibre.org ?

I also tried to use .png because most libraries are compatible with this format but it doesn't seems to work either.

PMTiles only stores one tile type, if you store vector data you need to fetch vector data.