Hacker news

  • Top
  • New
  • Past
  • Ask
  • Show
  • Jobs

Protomaps: Self-hosting map tiles has gotten cheap and easy (https://bruceroettgers.eu)

471 points by bcye 5 days ago | 89 comments | View on ycombinator

boramalper 4 days ago |

OpenFreeMap is a similar project:

https://openfreemap.org/

> What is OpenFreeMap?

> OpenFreeMap lets you display custom maps on your website and apps for free.

> Using our public instance is completely free: there are no limits on the number of map views or requests. There’s no registration, no user database, no API keys, and no cookies. We aim to cover the running costs of our public instance through donations.

> What is the tech stack?

> There is no tile server running; only nginx serving a Btrfs image with 300 million hard-linked files. This was my idea; I haven’t read about anyone else doing this in production, but it works really well.

neomantra 5 days ago |

We're doing something like this behind Cloudflare R2, same concept of owning the map infra (for privacy and access-control) and reducing load on public infrastructure.

If you are into this stuff, you can view PMTiles from the CLI with "gloss", or try to drag-and-drop on its web interface [1]. It seems large tiles (>128M) and some raster formats are failing; plus it would be nice to load from URL there. Will fix that...

(AI warning). ntmaps [2] is a Golang library that lets you use different tile providers, deployable in terminal or browser. ntplaygrounds [3] uses that and nt3d and ntactor to make a city simulation. Data is pulled from OpenStreetMap in those.

[1] https://nimbleterminal.com/gloss/app.html [2] https://nimbleterminal.com/ntmaps [3] https://nimbleterminal.com/ntplaygrounds

maelito 4 days ago |

For Cartes.app we used to pay Maptiler. While great, recommanded to start, without client revenue it was impossible to scale, we've hit 150 €/month bills way too fast.

Hence Protomaps. Hosting costs almost nothing.

The main problem though is that once you host your tiles, why not put what you want inside ?

Tune Tilemaker's processing.lua to your envy. Spend hours designing maps and building a Typescrpt dynamic Maplibre style.

motoroco 4 days ago |

yeah, basemaps are small enough to store and host cost effectively, but high res satellite imagery gets big and expensive fast as you go up in zoom level. I built my own satellite mosaic of North America for my app so I can offer users offline access to the tiles and had to stop at z17 because of projected storage requirements. high res global coverage can get you into the hundreds of TB range which is no longer in the "stick it on r2 and serve it with a worker" or "download and upload the entire dataset sequentially over your residential internet" territory

the fun/hard parts of the project weren't really scale dependent, although downloading source imagery and building the tile pyramids did take literally weeks to run. actually, the hardest part was getting demosaicing right, e.g. making the quilt seamless. filtering out cloudy and smokey/hazy tiles while picking alternatives from the same time of year so groundcover & crops are in a consistent growth stage so you don't end up with checkerboard patterns or cloud silhouettes randomly across your map. and there were other problems that came up more or less just because of how & when the satellite took the images that require exposure correction and more filtering

I also have a pelias index with 170M records for search and self-host valhalla for routing. the open source mapping ecosystem has really impressed me the more I learn with each project

sarkarghya 4 days ago |

if you are looking into self hosting, i highly recommend checking out https://versatiles.org/ the maintainer seems pretty passionate

> VersaTiles is a completely FLOSS stack for generating, distributing, and using map tiles based on OpenStreetMap data, free of any commercial interests. VersaTiles is a free and open alternative to commercial map services like Google Maps or Mapbox. It is designed for newsrooms, NGOs, developers, and public institutions who need reliable maps without vendor lock-in. VersaTiles is fully self-hostable, requires no API keys, charges no usage fees, and does not track your users.

gorayobi 4 days ago |

Word of warning. I had a client that was behind some corporate anti malware proxy. Turned out it stripped the range header from the request and simply did a request for the entire file. Had to implement a proxy endpoint just for them so they could do classic WMTS style requests insetad.

thatslast 4 days ago |

I'm making a Wikipedia walking game where each card comes in a sealed pack printed with the real streets around where you found it, rendered live.

With Mapbox or Google Maps I wouldn't even have considered building this game. Protomaps made it a no-brainer

Thanks to Brandon and the OSM contributors. This is what made the idea affordable for a side project.

nchmy 4 days ago |

I was very grateful to find protomaps recently for a project where I want to allow people to download custom regional subsections of the global map for offline usage.

After evaluating maplibre vs the somewhat-abandonned protomaps-leaflet library, I decided to go with the latter as I don't really need the fancy 3d gpu and custom layers functionality of maplibre. Plus leaflet is releasing a long-awaited v2 right now.

joshstrange 4 days ago |

I use Protomaps and absolutely love it. After getting hit with a Google Maps bill that was larger than I ever would have expected, I swapped it out for Protomaps instead and I’ve loved it ever since.

Dirt cheap to run, theme-able, easy to use.

X-Cubed 4 days ago |

Cloudflare recently improved their support for Range requests: https://blog.cloudflare.com/origin-range-requests/

cjlm 4 days ago |

I’m using (and donating to) OpenFreeMap and using Cloudflare to host custom tiles for my travel time map for Canada, à portée [0] - it’s been so effortless and the tiles are quick to load. No clunky tile server required!

[0] aportee.ca

starkparker 4 days ago |

map.pathfinderwiki.com runs a fictional setting's world map on PMTiles, with both the mapping data and the website stack open-source:

https://github.com/pf-wikis/mapping (using maplibre-gl-js and some custom Java code to manage layers, tile generation, and PoI collation from the associated MediaWiki)

https://github.com/pf-wikis/mapping-data (using kart)

dromtrund 4 days ago |

The svg tiles are decent for reverse geocoding too. I've had great success splitting gps routes into segments by pulling location data out of relevant tiles. A lot of the reverse geocoding APIs have pretty restrictive per-second limits and response times in the order of 1-2 seconds. Hosting this in an s3 bucket costs an order of magnitude less than any of the APIs I tried at my scale, with millisecond latency, no request limits and near-flat volume scaling.

maelito 4 days ago |

Checkout the new PRs submitted to Tilemaker. It appears building the planet could soon take less than 5 minutes.

perks_12 4 days ago |

Deploying this as I am typing this. The problem I have with Mapbox is that there is no way to limit spending. When the public key gets abused, it's a potentially enormous bill.

devadattas 4 days ago |

A PMTiles file on a bucket is the only map provider whose worst case is a rounding error.

jo-m 4 days ago |

I love protomaps, I have added it to my own hobby project to have a self-hosted fallback for regions (or times) where there are no SwissTopo maps available.

The app will periodically download the configured map regions and store the pmap files [1]. The Go backend then directly serves them to the frontend [2].

[1]: https://github.com/jo-m/cartomancer/tree/a02f042173b5ba1a7d9... [2]: https://github.com/jo-m/cartomancer/blob/a02f042173b5ba1a7d9...

blueblazin 4 days ago |

I self-host protomaps on CloudFlare for my side project: https://github.com/BlueBlazin/lowpolyearth

It costs me something like $2/month iirc, and it made tile querying faster over protomaps' free hosted endpoint.

globular-toast 4 days ago |

I use this on my blog with MapLibreGL. I wrote up how I do it: https://blog.gpkb.org/posts/hugo-static-site-maps/

One thing I really like is that the data is static. This isn't useful for some applications, but for my use, namely blogging about my travels, it's perfect. I wouldn't come back and edit the text or pictures to reflect subsequent events, so why would I edit the map? Being able to take ad hoc snapshots of the map at a point in time is perfect.

SafemapTecnolgs 4 days ago |

My product safemap.io is hosted on Protomaps. Highly recommend.

eruci 4 days ago |

I deployed self-hosted protomaps on geocode.xyz and it works like a charm. I wish it had more customization options though ( https://geocode.xyz/415%20C'WEALTH%20AVE%20WEST%20Singapore )

SeifHeakal 4 days ago |

I really loved this post keep going

doodlebugging 5 days ago |

I visited the link and Malwarebytes warned of a potentially malicious site:

p - proxy - tp8ez dot bunny dot run

so I closed that window.

What else you got?

rw2 4 days ago |

agree with this totally, use it on a project I am working on and it now takes like 3-4 hour to have a self hosted map of the world on your computer.

YuriyChobotok 4 days ago |

Pretty cool option and easy to reuse.

pluto_modadic 5 days ago |

okay, but what clients work with this approach?

edumucelli 5 days ago |

Really cool, did not know about it!

mokto 4 days ago |

Super nice!

emersion 4 days ago |

Another open-for-everyone tile server is Tuiles en Libertés : https://tuiles.enliberte.fr/

cnczeric 4 days ago |

[flagged]

Eunice99x 4 days ago |

Same experience on the routing side. I self-host Valhalla on a cheap VPS for a road-trip planner instead of paying per request for a routing API. The setup takes an afternoon of building tiles and figuring out the config, but after that the cost is flat, and that's what makes a free tier possible at all. Paying per request for routing would have killed the free plan.

ankur_misra 4 days ago |

[flagged]

musclehed03 4 days ago |

[flagged]

lakhya 4 days ago |

For a browser viewer on a different origin, I’d test the actual 206 response and CORS behavior from the deployed page, not just from curl. If the client needs to inspect `Content-Range` or `ETag`, those response headers may need to be exposed; a repeat range request also shows whether the CDN is serving the expected cached slice.

mikevannelli 4 days ago |

[flagged]

h4kunamata 4 days ago |

CoMaps said hi and uses OpenStreet maps.

It works amazingly on GrapheneOS, Android Auto, and Desktop app via Flatpak.