Live data from Hacker News

Host your own OpenStreetMap Map Tiles

altilunium.my.id

11–20 of 45 posts

Re: Host your own OpenStreetMap Map Tiles

#11

Would be much better if this involved hosting on a normal webserver, rather than requiring a specific one. Another piece of software to keep up-to-date, just for maps.

You can host .mbtiles files with PHP very easily. I wrote a tiny piece of code 9 years ago that I used for a high traffic map server and it worked just fine. https://github.com/infostreams/mbtiles-php

I'm sure there are newer solutions out there, which might have more features and are actually maintained. But this did (and still does) the job.

Re: Host your own OpenStreetMap Map Tiles

#13
Thanks for sharing this! I have a hobby project that has hit the paid tier of my tileserver (thunderforest, and they're great) and I'm trying to figure out if I should be figuring out a business model or DIY'ing my tiles. Tileservers see to be expensive in general.

Re: Host your own OpenStreetMap Map Tiles

#15
I generated my own vector tiles using OpenMapTiles. Planetiler looks very promising too.

I serve the tiles using TileServer GL Light. It works but it requires Node.js v10.

OpenStreetMap is planning to make their own vector tiles style to convert their raster tiles. Looking forward to that! https://github.com/openstreetmap/operations

Re: Host your own OpenStreetMap Map Tiles

#16
post #5

The way I've done this is to use planettiler to generate vector tiles for the whole world and then pack that into a squashfs archive. That way I don't need an additional program to serve them, and I can regenerate the whole archive every couple of months or so (I don't need the latest data).

An exciting new standard here is pmtiles; a standardized way to store map tiles that can be used via http range requests. I believe planettiler has plans to add pmtiles output support as well. https://github.com/protomaps/PMTiles

Nice and looks very interesting! How would PMTiles handle compression? IIRC content-encoding and range requests don't play nice together, currently my server supports uncompressed, gzip and brotli for my tiles (compressed on-demand once and then cached).

Re: Host your own OpenStreetMap Map Tiles

#17

Earlier quoted context omitted.

An exciting new standard here is pmtiles; a standardized way to store map tiles that can be used via http range requests. I believe planettiler has plans to add pmtiles output support as well. https://github.com/protomaps/PMTiles

Nice and looks very interesting! How would PMTiles handle compression? IIRC content-encoding and range requests don't play nice together, currently my server supports uncompressed, gzip and brotli for my tiles (compressed on-demand once and then cached).

For the next revision of the JS decoder I'm including `fflate` as a dependency so clients can decompress gzipped tile data using JavaScript.

https://github.com/protomaps/PMTiles/blob/master/js/package....

Re: Host your own OpenStreetMap Map Tiles

#18

Would be much better if this involved hosting on a normal webserver, rather than requiring a specific one. Another piece of software to keep up-to-date, just for maps.

The highest zoom levels are generally generated on demand, as there’s so many tiles. Zoom level 20 is over a trillion tiles, most of them worthless blue sea tiles. We’re probably talking hundreds of terabytes just for the file system metadata, to say nothing of the tiles themselves. Of course, you could forego the ability to zoom in very far.

With vector tiles you don't need to generate up to z20 - just to z14 is enough, and that can easily be done in a single .mbtiles (which is an SQLite database of vector tiles).

Re: Host your own OpenStreetMap Map Tiles

#19

Would be much better if this involved hosting on a normal webserver, rather than requiring a specific one. Another piece of software to keep up-to-date, just for maps.

Here's a little bit of code I wrote that lets you host from a normal webserver, where that "normal webserver" is Apache: https://github.com/systemed/mod_mbtiles
Post reply on HN