848 points · by hyperknot · 2y ago · 234 comments
After 9 years of running my own OpenStreetMap tile server infra for MapHub (https://news.ycombinator.com/item?id=11389989), I've open-sourced it and launched OpenFreeMap.
You can either self-host or use our public instance. Everything is open-source, including the full production setup — there’s no 'open-core' model here. Check out the repo (https://github.com/hyperknot/openfreemap). The map data comes from OpenStreetMap.
I also provide weekly full planet downloads both in Btrfs and MBTiles formats.
I aim to cover the running costs of the public instance through donations.
Looking forwards for your feedback.
I'm writing an application that lets you view historical data, and the problem is that most/all map services show only current data. It would be nice if the map reflected the year of the data we're layering on top.
So if you want to make some money, there's an option for you!
https://www.openhistoricalmap.org
I don't think you can pay for it, but I'm sure they'd accept donations!
Perhaps there is a different dataset with better historical accuracy than OSM, but I do not know of one. You'd likely have to reduce your scope: trails in a specific park? Roads in a specific city?
As another commenter notes, there is a sister project OpenHistoricalMap that focuses on mapping historical data. It is rather sparse compared to OSM, but super fun to explore around e.g. NYC.
Especially here in Europe / Germany, where entire quarters where bombed to rubbles newer streets do not match neither namely nor spatially.
I loved how you could "move back in time" in street view. I think that has been killed too? There is a lovely Twitter/X account for Detroit tho: https://x.com/DetroitStreetVu
has a great selection of historical maps.
Why OMT instead of protomaps? The latter is clearly where the community is moving towards (albeit very slowly).
I'm somewhat sceptical about the "free with no API keys" idea. I guess your service is not guaranteed to be up so no one too big will rely on it. But what if you start getting abuse or someone using them on some humongous site (e.g. one of those cheap restaurant email builders that always embed a map), and you start getting way too much traffic from random sources and websites. What would you do?
> What about PMTiles?
> I would have loved to use PMTiles; they are a brilliant idea!
> Unfortunately, making range requests in 80 GB files just doesn't work in production. It is fine for files smaller than 500 MB, but it has terrible latency and caching issues for full planet datasets.
> If PMTiles implements splitting to <10 MB files, it can be a valid alternative to running servers.
First 100KB of a 100GB+ file:
curl -H "Range: bytes=0-100000" https://overturemaps-tiles-us-west-2-beta.s3.amazonaws.com/2... --output tmp -w "%{time_total}"
First 100KB at the 100GB mark:
curl -H "Range: bytes=100000000000-100000100000" https://overturemaps-tiles-us-west-2-beta.s3.amazonaws.com/2... --output tmp -w "%{time_total}"
BTW, we are discussing latency with bdon in this issue, it seems to be specific to Cloudflare: https://github.com/hyperknot/openfreemap/issues/16
- There is the Protomaps schema. It's competing with OpenMapTiles and Shortbread (https://shortbread-tiles.org/)
- There is the Protomaps file format. It's competing with MBTiles and say Btrfs images in OpenFreeMap.
- There is the Protomaps styles. It's competing with OSM Liberty and OSM Bright styles (https://github.com/maputnik/osm-liberty)
- There is the way to host the tiles, on CloudFlare workers, range requests, etc. It's competing with MBTiles servers or OpenFreeMap's nginx servers.
About getting abuse, how do you imagine it gets abuse? It's a static file showing OpenStreetMap data.
I mean traffic is the only thing what can be a problem, but I think Hetzner should be good till 30-100 TB per server.
2) The file format (PMTiles) addresses a different audience than either MBTiles or Btrfs images. Both of those require administering a server for tiles, while PMTiles requires static blob storage and nothing else. You do have the option of using a server like MBTiles/btrfs which ought to be comparable in latency, and that's documented here: https://docs.protomaps.com/deploy/ as well as Lambda, Cloudflare Workers, Google Cloud Run and Azure Serverless functions.
3) There are no existing styles for MapLibre GL that work off the Tilezen layer, generalization and tagging scheme, so we need to develop one style, with multiple themes.
Can you elaborate on this ? I'm derivating OMT and am quite worried now ^^
On top of a custom protomaps tileset and a few other MapTiler options (such as satellite and hiking), it packs a search engine, a basic OSM place UI, transit calculators (walk, bike with profiles, transit, car), small features like ruler and favorites, transit maps, photos of places, place search by categories, and the French open source street view Panoramax.
Of course, given the scope, its alpha software.
It's built locally for France and French speaking users, though most of the code is English, some data sets are not. I'm spending ~ 50 % working on transit, lots need to be done.
You can test it here : https://cartes.app.
The aim is not to provide map tiles as an API to other project, but to build a UI on it.
Are you using opentripplanner for routing?
The problem is filtering good ones. See my PR of the day, where I'm using only the images that are featured on Wikipedia pages. It gives better results than google maps in lots of places. Also some weird pictures like logos but I'm confident they can be ruled out.
Your map is cool !
https://plantopo.com/geophotos#13.92/50.91621/-1.37752
https://cartes.app/?photos=oui#13.92/50.91621/-1.37752
With this second link you'll understand the why of my PR : there's just too many Wikimedia photos ^^
Edit : PR merged, you'll see less photos in 1 minute https://github.com/laem/cartes/pull/611
My project is for planning hiking trips so the areas I'm searching typically are places in the wilderness that don't have many photos. Right now I'm not doing any ranking. I just semi-randomly take ten photos for the search area.
No, Motis. I picked the first I could install on my computer at the time. Turns out, it's a very promising project.
But switching to OTP wouldn't be such a problem. GTFS in, JSON out. It's a one day work change for basic functionnality.
Edit : just watched some minutes, he's rebuilding low-level components, like route finding. Impressive stuff but not quite user-friendly.
Yes, it does not seem like he makes a business or a product for a wide audience. It's more about exploring the unknown, teaching programming and being entertaining.
Although I adore such ambitious projects that seem insurmountable at the first glance.
We used to host our own mbtiles map for like $11/mo, but the problem was (this was prior to planetiler and people generating public worldwide mbtile dumps) there wasn't a free/cheap source for regularly-updated mbtiles. The dump from OpenMapTiles was not updated for years.
So we gave up and went to mapbox, where we regularly exceed the monthly free tier for web, but they give us a discount. Because that is a scary scenario and we are dying to pay a fixed monthly fee, I think we will try yours and donate!
My only feedback on your tiles is the lack of POIs. Mostly just bus stops and an occasional supermarket in my area. But I see from the github that this is on the roadmap.
For POIs, they are present in the data, it's just that the styles might not have the matching icons for them. But you can always make them into a circle, etc.
Having said that, working on the styles is a big and never ending effort, so if someone would like to help with matching the POIs then contributors welcome.
Protomaps also provides daily updated full-planet pmtiles [2], from which you can create a pmtiles extract using its CLI.
[1] https://github.com/onthegomap/planetiler [2] https://docs.protomaps.com/basemaps/downloads
Slightly off topic, but how come there doesn't seem to be any open projects using the Overture maps data?
> Overture is a data-centric map project, not a community of individual map editors. Therefore, Overture is intended to be complementary to OSM. We combine OSM with other sources to produce new open map data sets. Overture data will be available for use by the OpenStreetMap community under compatible open data licenses. Overture members are encouraged to contribute to OSM directly.
Sounds like it would be a good data source, or am I missing something?
E.g. restaurants can come from an old Facebook page and the geocoding might not be accurate compared to a survey.
So where OSM might have a restaurant that closed 8 years ago, overture has every restaurant that's been at that location for the past 8 years.
https://python-visualization.github.io/folium/latest/ https://leafletjs.com/
[0]: https://developmentseed.org/lonboard/latest/
[1]: https://developmentseed.org/lonboard/latest/how-it-works/
You may think it noble to "only take donations" just to pay the hosting cost, etc. but providing people support is a completely different thing. People are stupid, needy and inconsiderate of your time, feelings and experience.
If you don't want to run ads, great! But your time should be compensated fairly as well. You should be charging businesses for things, with a substantial cost for substantial work. Charging a business is not the same as charging an end user and you should not be averse to doing so.
As a user, free or paid, it'd give me a lot more faith in this living past tomorrow.
And the risk of this project is largely mitigated by offering the full repo as open-source, so you can always self host this if needed.
The latter should be easier to manage with more predictable traffic, while giving you more leeway to deal with abuse on the free servers if it ever becomes an issue.
(a) They're making millions, you deserve a cut of that.
(b) If making money makes you more likely to be around in 10 years, that's attractive to businesses. Nobody knows when your donations might suddenly dry up.
I honestly believe this project can cover $175 per month eventually.
Of course there is the countless hours which went and which can possibly go into this, but to cover the hosting is still meaningful.
Let's say 1 year from now your day job gets toxic and you have to work 18 hours a day just to pay your rent and expenses. Are you still going to maintain this?
What if the economy goes to shit and you have trouble scraping that $175/month? How long are you going to pay $175/month for something that isn't making money?
What if, instead, this became a part-time job of yours?
If I was a commercial user of your product, some assurance that your random personal situations aren't going to affect the product stability for a long time would be a good thing.
If you want free servers/bandwidth around the world, hit me up. My email is in my profile.
I know nothing about mapping, but I’ve always had a dream of making a private neighborhood map which labels each house with people, sort of like a visual Rolodex. It would be great to have property boundaries, too. Do you have any suggestions for places to start? I don’t even know what file formats would hold this sort of data.
I work for a company (onXmaps) which produces user-friendly maps of such information. You could use our app to create such a "rolodex" of your neighborhood, by annotating individual parcels with your neighbors' information.
In my mind I’d really like to host my own map which neighbors could share, just starting from a baseline of parcel boundaries and a way to drop info on each plot (onX does this wonderfully already).
Back in the day, my mom would make a little neighborhood diagram using MS Publisher and drawing boxes at the approximate locations of houses, and include names & phone numbers of each house. She would then distribute copies to the neighbors to hang on fridges. I loved that idea and basically want an online version of that, in a perfect world!
public domain map data in GeoJSON format.
also, for google maps I know you can respond to interactions with the supplied points of interest like buildings, including homes, and from that point you can obtain an address via reverse geocoding or some other technique. I expect other mapping tools may have similar abilities but I don't have any experience with anything other than Google.
I'm not sure if their hosting works for you because you might be serving byte ranges. I think we're paying 2k/month usd for like 300TB/month. Backblaze-to-fastly is free, so no egress.
Love your project, more power to you. I'll be using this for a few side projects for sure.
I don't think this project will ever make $2k per month. TBH, I'd be happy it it ever reaches $200 per month. I have to be very careful about what hosting providers to use and CDNs are out of the question.
https://docs.hetzner.com/robot/dedicated-server/network/10g-...
As for other cdns - I remember https://neocities.org/ built their own cdn - but I couldn't immediately find a blog post about the cdn, or something related in their GitHub (unless every node runs part of it, which would make sense, I guess).
They could use you as a PoC/demo for their serverless stuff. Same with cloudflare.
It's worth it to ask. I can send you the contact for our fastly rep if you'd like.
Maybe it's worth front-ending it with cloudflare free, just to see/measure cache hits/requests/bandwidth?
In addition to Cloudflare, bunny was on the radar too.
I believe Hetzner should not have any problem with using 100 mbps out of the 1 Gbps on their servers. That's 30 TB/month for free, per server. It'd be $300-$1800 per month on Bunny.
edit to fix typo
For MapHub to work, I had to invest in my own tile server infrastructure: there is no way I could have made MapHub financially profitable with a 3rd party tile provider. So I kept iterating and iterating on the tile server infrastructure and after 9 years I arrived at a state which was worth open-sourcing.
I'm happy if this project gets to the point from sponsorship where my hosting bill is covered ($175 per month), but it doesn't have to be financially successful on its own.
I'll keep working on it because it's part of my main business, not because I beg for donations.
If so I'd say you need to work on the SEO and findability side.
Nginx is fast, but I think that’s asking too much of it.
Of course that problem hasn’t happened yet, but it’s what I’d be worried about.
So using nginx in a 1 Gbps server is definitely not asking too much of it, or I might not have understood your comment clearly.
Why would Facebook decide to use my tile server? When a company's business depends on having reliable map tiles, they either self host or have an Enterprise deal with Mapbox, etc.
The specific example you give is not going to happen.
So disrespectful and so ignorant. You rely on free software without even knowing it but are happy to not dig around much and benefit from it. But heres a new project and you call it begware.
If you have nothing nice to say, don't say anything at all.
This only reflects how fucking stupid you are. If you read the post in any detail, you'd realize the author has been running a paid service for a while (9 years) and does not need your help.
Versatiles provides a free and open to use Server under tiles.versatiles.org which is sponsored by People around the CCC.
Versatiles is also the First to offer a free to use vector card server, which is also amazing.
(For the German Readers: https://media.ccc.de/v/ds24-406-versatiles-freie-karten-fr-a...)
Making this automatic might not be easy, but I might do it one day, it might help with the donations.
That total has gone up. :-)
Not currently having any plans of using openfreemap, but I like the cut of your jib. I'm currently in the process of generating aerial tiles for Colorado, and updating 2 of our map tile sets (bitmap tiles, Here and OpenStreetMap), but at some point we should switch to vector tiles. When we do I'll try to get a business sponsorship going, but it is nearly impossible for me to get the company to pay for sponsorship. :-(
I'm currently using Stadia Map Tiles from when they went from free to paid.
If I'm understanding you correctly, I can switch to your instance to serve tiles to my site for free once again? I'm very happy to pitch in some cash to help keep the servers running.
I am running leaflet.js and I guess I should be able to figure out how to migrate, but if you already have a tutorial somewhere, please let me know.
This is really cool.
The pitch for the project is here if anyone in Taiwan is interested in joining: https://hackmd.io/7K4kLkseTYCPI7DWoNv5mA?view
Hackathon info: https://g0v-jothon.kktix.cc/events/g0v-hackath63n
The back-end is currently based on a postgis database and a python app serving geojson tiles at zoom level 16. It currently runs on a single Hetzner server due to the resource requirements of imposm which is used to import the data into the database. Reducing hosting costs would really help us to insure the long term sustainability of the app.
I don't know yet how different the schema is and how easy it will be to support.
Soundscape was originally a Microsoft research project but they open sourced it when they shut down the app last year.
It's for a hobby project that's outlasted well-funded projects, so the traffic kept increasing as competitors folded.
A few years back, I tried to run my own tileserver, but the difficulty of creating an updated vector tileset put me off, and I just continued paying the Google tax. Last month I finally got a really nasty bill, and it forced me to cancel my weekend plans and change to Mapbox.
I like Mapbox for its other API features, but I'm wondering if I could alternate between this and Mapbox, so I keep my overall costs lower. I'd prefer to donate a fixed amount instead.
Question: Does anyone have experience with switching the underlying OSM mapping services either programmatically or by webpage? I'm more asking around the end-user experience. I suppose I have to check what features of mapbox-gl 2+ I use that won't be available in the libre forks.
Any tips in general? Not just for breaking in but what you wish you knew
Once you have specific goals about what you're trying to do with data, and how to visualise it etc, then there are usually straightforward solutions to achieving them. The difficulty can sometimes be describing them, or forming the right conceptual model.
It's worth getting really familiar with the GeoJSON spec, and using that as your data structure wherever possible.
Slightly off-topic, one thing I'm having a hard time finding is satellite imagery. I need to self-host an offline web application using CesiumJS, and while I can spin up a map server, I can't find satellite imagery for free or cheap. I've used MapTiler[0], their server works great and they offer low-res satellite imagery for free/testing, but their high-res images are out of my price range.
Anyone know of resources for downloading offline images of satellite imagery, compatible with OpenFreeMap or other server for use with CesiumJS? Doesn't have to be super recent images but would be nice.
Last year I made a website for my gf where I had to build a custom map of Paris, and I struggled a lot trying to figure out how to actually make a map from scratch while avoiding paid services like mapbox.
I finally managed to hack something up using openstreetmap data, then some manual work in QGIS to customize the look, and voila - I had a bunch of folders filled with raster tiles.
This site is deployed for free on Netlify and is basically just a React SPA, a public folder with tiles, and I give the tile URL template to the OpenLayers lib to display it all nicely on the screen. Simple and it works!
I always wanted to improve the map a bit by using vector tiles as I think it looks nicer, but I thought you need a dedicated server for that? (unless I'm mistaken, correct me if I'm wrong)
> Unfortunately, making range requests in 80 GB files just doesn't work in production. It is fine for files smaller than 500 MB, but it has terrible latency and caching issues for full planet datasets.
Wondering which part incurs the latency here.
In summary, on a cold start (so now when it's on HN it might be totally meaningless), the following page loads in like 8-10 sec for me: https://pmtiles.io/?url=https%3A%2F%2Fdata.source.coop%2Fpro...
Technically why it's slow is entirely on CloudFlare, so I can only guess. But probably they are not mirroring files of this size across their datacenters / servers. I don't know how their public buckets hosting is done, but it's definitely very slow.
OpenFreeMap on the other hand seems almost instant for me.
With 1TB free traffic from the CDN, and pretty small costs for S3 and Lambda@Edge, it's probably even cheaper to self-host I guess. Even lower costs would be possible by entirely using CloudFlare services (CDN, R2)...
Question, why use btrfs?
- MBTiles - an SQLite file, each file is a row in a table, you need a server to serve it.
- PMTiles - a single file, optimised for serverless usage.
- Extract them into a directory, which in practice should be on a partition image. This is the approach I choose.
I tested ext4 and Btrfs and I choose Btrfs. The reason is how ext4 and Btrfs handles inodes. Btrfs handles inodes so much better compared to ext4, it doesn't allocate them at start and also allows putting tiny files right with the metadata.
Because here the average tile size is only 405 bytes, most of the tiles can actually stored with the Btrfs metadata block. From the latest run:
Btrfs data is 51.57GiB
Btrfs metadata is 84.37GiB
I wanted to give repackaging the btrfs image a shot but the download was pretty slow - I assume your server is getting HN-hugged a bit so I didn't want to make it worse and stopped the download.
btrfs.openfreemap.com just a public Cloudflare bucket, no idea why it might be slow.
I've been making some custom map stuff for mountain bike trails and I'd really like to move to self-hosted vector tiles for all layers, but too much of what I find says to start with Planet.osm when all I really need is a State (in the US) or even a few-miles-wide area.
(My goal is to basically snapshot OSM data, generate tiles, and use that until I decide to do another snapshot down the line, so the underlying data doesn't change. And limit it to a small area because that's all I need.)
Examples of maps I've done this way, and want to improve, are: https://trailmaps.app/ramba/ and https://trailmaps.app/dte/
Another option is to use the extract functionality in pmtiles [4] to extract your area of interest from their daily full-planet pmtiles builds. You can then statically host that file and use that in your client with one of their client libraries.
[1] https://github.com/onthegomap/planetiler
[2] https://download.geofabrik.de/
https://i.postimg.cc/tCn1xSRF/image.png
p.s. very cool project indeed
edit: I don't know how it happened, but while panning the map with the mouse, the map flipped upside down.
The Vatican situation is trickier than you'd think, as it's on country level, while Rome is on city level, and naturally you'd want to give countries a priority over cities. Like on low zooms you only want to show countries, then as it gets closer you show cities. Well, except for Vatican.
If not, declaring one with IMGui+layers can be done in a week from any experienced C++ programmer. The included demos for OSGEarth already depict a minimal client with impressive 3D maps for a nearly non-supported demo.
I think KDE/Plasma lost a great oportunity there by not adopting OSGEarth.
Do you know about https://panoramax.fr ?
On a related subject, I remember seeing MapHub sometime ago and I have it in my bookmarks for one of my (forgotten?) projects. Whenever I find some free time I need to sit down and try the free tier to see if it will do what I have in mind.
I'm a little curious about the setup bit for (self) hosting - it's essentially a series of bespoke python scripts? Not cloud init, not Ansible - and not shell scripts - nor Terraform/tofu.
Would love to hear a few thoughts of how you arrived at this setup - and if you re-use parts for other projects?
I spent a long time learning Salt stack (like Ansible) but it never really paid off. When you're writing o config to set up one specific project on known infrastructure you might as well just code it in the scripting language you like best.
Also thanks for the donation!
Curious that you describe the OSM Bright style as "abandoned by their upstream project". I see edits 4 months old (https://github.com/openmaptiles/osm-bright-gl-style), but I only looked superficially. Is it really abandoned?
One thing that tripped me up is the zoom -- the affordance for zoom in/out across most other mapping UIs is via mouse motions -- how come in your demo it's restricted to the +/- buttons? Perhaps I missed something...
Thanks for sharing this, looks very neat.
Of course, you have 100% control over exactly what controls you configure with MapLibre, when you set up your app.
I think it would be quite a straightforward task to transform it into a Docker file. I'd be happy to link to it on GitHub.
The other one is Mapbox GL from which Maplibre was forked. But you only use that with their tiles now.
See Streetcomplete switching to MapLibre.
How does this project compare to Apache Baremaps (incubating)?
In total, there are 271 million hard links. So out of 300 million files 271 are hard links!
The file system limit is 64k hard-links for the same file, so I have to handle the case when it's reached and then start a new file for the next 64k.
I had never heard that, so I went sniffing around and it seems to be ext4 specific[1] but I wasn't able to easily get the limits for ZFS (or xfs, etc), so depending on how much glucose one wished to spend it may be better to use a different FS than all that renaming work around
Basically Protomaps / PMTiles allows you to do this serverless, but it has it's downsides.
There are two ways to use PMTiles with Cloudflare:
- Putting the file in a public bucket and use HTTP range requests.
- Deploy a worker to access it.
For the range request version, you can test PMTiles here: https://pmtiles.io/?url=https%3A%2F%2Fdata.source.coop%2Fpro....
It loads in 8-10 sec for me on a cold start. Of course it gets faster if many of us try to request it at the same time, but if you check it once per day for example, it'll be really slow, up to 10 sec.
Compare that with OpenFreeMap here: https://openfreemap.org/quick_start
It's near instant for me. (I know it's not full screen but you can make the app and then see how it's in full screen).
For the Cloudflare Workers version, I didn't find any publicly available full planet test, so I don't know the performance, but Workers are not free. It might not matter for a small project, but the $0.30/million requests per month can easily add up if your project gets popular.
In terms of OpenFreeMap, hosting it on a Cloudflare Worker would be prohibitively expensive.
The latency you see on https://pmtiles.io/?url=https%3A%2F%2Fdata.source.coop%2Fpro... is representative of how PMTiles works on AWS S3, coming from the us-west-2 region. It will be reasonable to load for those in the western US and likely quite slow from Europe or Oceania.
If you want to make a direct comparison of Protomaps to OpenFreeMap, you need to compare serving OpenFreemap with NGINX from btrfs on disk, to running `pmtiles serve` on a `.pmtiles` file on disk, as described here: https://docs.protomaps.com/deploy/server
The OpenFreeMap page for me (in Taiwan) takes 1-2 seconds per tile, which is more than double the load tile for the PMTiles in us-west-2 example linked above.
The best solution to get latency competitive with commercial providers, for a global audience, is to cache tiles at CDN edge locations. I describe automated ways to do that with Cloudflare Workers and AWS Lambda + Cloudfront here:
https://docs.protomaps.com/deploy/cloudflare https://docs.protomaps.com/deploy/aws
I'm also experimenting with http://tigrisdata.com which lets you geo-distribute a static storage bucket like in this example: https://pmtiles.io/?url=https%3A%2F%2Fdemo-bucket.protomaps....
I can imagine workers to be fast, it's the range requests which are super slow. It's also outside of your control, it depends on how Cloudflare and S3 handles range requests to 90 GB files.
I think if you could make PMTiles split into files <10 MB, it'd be perfect with range requests.
1. https://www.weather.gov/documentation/services-web-api