Remix.run Logo
mattrighetti 13 hours ago

Does anyone self host maps? If you do, mind sharing the pros, cons and tools to do that?

homebrewer 12 hours ago | parent | next [-]

We've been self-hosting protomaps (aka pmtiles) for several years. The only thing you need server-side is a web server that can serve static files and supports range requests (so anything works; I've tried caddy and nginx). The map is one large file, it's easy to share it between however many servers you need.

https://docs.protomaps.com/guide/getting-started

Downsides? Nothing major that I can think of. You have to add another client-side dependency (support for their custom protocol); the library is pretty small and easy to audit.

Editing map styles is slightly more difficult because generic maplibre styles won't work with it: they add a bit of custom sauce on top. IIRC this editor worked fine, you can import one of protomaps styles and base your work off it:

https://maputnik.github.io/editor

That's probably it.

throw_away_623 12 hours ago | parent | next [-]

Are the names of cities/streets included in the tiles, or do they have to be placed from a different data source?

homebrewer 12 hours ago | parent [-]

No, the names are there in the file, streets included. Their default styles did not support the languages we needed out of the box (everything was shown in the local language or English IIRC), but it was easy to fix by patching the style. I don't remember the exact fix, but it was about as simple as replacing something like `["get", "name_en"]` with `["get", ["coalesce", "name_xx", "name_en"]]`.

throw_away_623 12 hours ago | parent [-]

Is there enough information to show exact addresses? For example "221B Baker Street"

homebrewer 11 hours ago | parent [-]

Sure. You can look at their demo, it uses the exact same single-file hosting mechanism (the network requests tab in the browser dev tools confirms it — it doesn't send any other requests), and street/house addresses are visible on the map.

https://maps.protomaps.com

yuretz 9 hours ago | parent | prev [-]

How do you update pmiles? Do you have to rebuild the entire map every time? If so, I think that's a downside/limitation for some use cases.

storystarling 4 hours ago | parent | prev | next [-]

I had to go down this path for a print-on-demand book project. If you need high-DPI assets for physical print the commercial static map APIs are prohibitively expensive or restrict usage rights for resale. Self-hosting was basically the only way to generate 300dpi rasters at scale without destroying the margins.

Humphrey 3 hours ago | parent | prev | next [-]

Have used pmtiles to self-host a “find your nearest store” map, which only needed to cover Australia. Created two sources: (1) a low-detail worldwide map to fill out the view (about 50 MB), and (2) a medium-to-high detail source for Australia only, up to zoom level 15 (about 900 MB). In this case, there’s no need for up-to-date maps, so we were able to upload these two files to S3 and forget about them. Works great!

linsomniac 12 hours ago | parent | prev | next [-]

We use mod_tile+renderd: https://github.com/openstreetmap/mod_tile

In short: We have a script that builds a pbf of the area we are interested in (Colorado, USA) from OSM, then set up a openstreetmap-tile-server container with that data, bring in our styles, and then set up renderd.

davidkwast 5 hours ago | parent | prev [-]

I do. The pros are hosting own data and have total control over stack and cloud hosting. The cons are having to code your own stack and do cloud management. I use PostGis to storage and serve vector tiles. And I use a simple backend with AWS S3 to store and serve raster data (GeoTiff COG).

matt-p 4 hours ago | parent [-]

Respect this commitment. I think to be honest I'd only ever consider hosting a tile server if I was actually rendering data on the tiles or there was something 'special' about them (e.g style). Using $whatever hosted tiles are likely to be faster for the user as they'll be cached, served statically.