Serverless maps at 1/700 the cost of Google Maps API
protomaps.com
protomaps.com
> A web application with 50,000 map loads using the Google Maps API will cost $350 per month.
> A similar amount of traffic running through a Protomaps CDN install on Cloudflare, with an average of 20 tiles per session, costs fifty cents in Cloudflare Workers request fees.
$350 versus $0.50! Who's going to be the first to build a (maybe Google Maps-compatible?) API on top of this and sell it for a fraction of the cost?
Edit: Looked around a bit and Protomaps already offers a hosted map through Github Sponsors here: https://github.com/sponsors/protomaps
http://github.com/sponsors/protomaps
But being "Google Maps compatible" will never be possible as long as the Google Maps client library and data are proprietary.
Fwiw with "Google Maps compatible" I didn't mean showing Google's Maps, I was thinking more a drop-in replacement to (some subset of) Google's client library.
Most open source efforts have consolidated around MapLibre GL https://maplibre.org which is a maintained fork of Mapbox GL before their switch to a source-available license.
Then just stub out any other API call with "alert('Not implemented, but PR's welcome!')"
And as far as webmasters are concerned, switching from google maps to your maps involves just switching out the <script> tag for a different one.
It's not as impressive as you make it sound. The real value of the Maps API is in 1) routing and 2) local business details. These are both hard for anybody else to provide, so Google prices them accordingly. The price for the tiles is just an extension to the overall pricing.
The current offerings of google, mapbox, bing, etc are prohibitively expensive when you just need a small subset of their features.
The company I work for is a happy customer of maptiler.com which even offers routing and reverse geocoding. It might not be as great and up to date as google's, but it's more than enough for our apps.
> However, OpenStreetMap’s own servers are run entirely on donated resources. They have strictly limited capacity. Heavy use of OSM tiles adversely affects people’s ability to edit the map, and is an abuse of the individual donations and sponsorship which provide hardware and bandwidth. As a result, we require that users of the tiles abide by this tile usage policy.
The default OSM tile server is not here to serve your startup.
As I've said, the solutions are there, and there is an actual demand for cheap vector tile hosting without all of the other cruft that is bundled in the commercial solutions but isn't actually needed.
Fortunately there’s a large selection of background layers for leaflet: http://leaflet-extras.github.io/leaflet-providers/preview/ I quite like CartoDB Positron for as a muted background.
> All Maps Embed API requests are available at no charge with unlimited usage.
I used it for my app (https://turas.app) and it is very, very capable for a free product (cross my fingers that they don't jack it up like they did Maps API proper).That situation is actually kind of outrageous. Municipalities and governmental bodies feed data into Google rather than publicly-accessible platforms (like OSM). And so do the private businesses, with no regulatory mechanism forcing either them to submit the same data to local / public databases (like yellow pages, national map site / registries, or OSM) or forcing Google to provide dumps of its data for the public to use.
I hate having to access Google to find information which is simply not available in map for, or at all, elsewhere.
I'm not necessarily saying municipalities should build this stuff out themselves, only that it freaks me out when small governments rely on giant corporations to support their infrastructure.
I used to provide data to Google, mark missing postboxes, etc. Then I realised I am just helping them make money.
Also they used to be quick, and got sloppy - 7 years ago my submission would get processed in 1 week. Recently i submitted nearby postbox, with GPS coordinates and pictures - 6 months, no responce.
This is lile with social networks - the content is what matters, and people give it away for free
(Mobile app where you can fix and enhance OpenStreetMap data on the go.)
Not sure if there are ready use alternatives, but at least in theory with OSM you could fully control what is being shown. And what not.
Google Maps isn’t charging for raw bandwidth/storage. They spend massive amounts on R&D to make Maps the most useful and competitive global mapping solution. This comes at a cost, which is completely different than using community-maintained partially-complete OSM maps.
Google is crowdsourcing both
That's like, 1 pan or 1 zoom. It might as well be a static map if the users don't actually interact with it.
They are comparing the price using Cloudflare, which although cheap, has poor performance.
I don't know anything about these services or their pricing. Maybe AWS costs about the same as Cloudflare, but it's cheeky to have inconsistent comparisons like this. Ideally, this post/advert would provide the equivalent AWS price also (or provide Cloudflare performance numbers).
Cloudflare R2 latency is tricky to predict and can be anywhere from a few hundred milliseconds to 1s+ in my experience. This is for cache misses, only, of course; cache hits are comparable to AWS. Cloudflare really has every incentive to improve their product so I expect this to be much more competitive in the near future.
https://protomaps.com/docs/cdn
Self hosting pmtiles is straightforward also, make a file available to a server that supports range requests:
https://protomaps.com/docs/pmtiles#2.-serve-your-file-locall...
The cost will likely be in developmetn and maintanance, not service fees.
Use whichever API is clean, simple, stable and you don't have to think about.
This might be a solution for larger operations that have some intrinsic relationships with maps.
There would be some irony if a 3rd-party monetize off of Google shoulders a compatible-API to their Map service.
Given that's what they did to Java.
Never trust Google Cloud or run any production servers with them. They have zero empathy for you.
Just today, we got screwed by Google Cloud (as a 4 yrs customer) when they abruptly shutdown our production servers just because we didn't fill up a form on-time.
My story: https://twitter.com/Ryan_Liao/status/1634103410525077504 (happens today) [Link Updated]
I am not defending them, but this is totally on you. What was the missing information? Lack of identity verification or credit card verification? Again that's on you. You should have also received a warning in the cloud console and if you hvae the cloud app on your phone, there as well.
You are defending them. Unless OP is disingenuous, the reputational loss of an unhappy customer is hard to shake. Customers will make mistakes, if the cloud provider doesn't have automated systems to catch and prevent those mistakes then they aren't doing well in customer service.
A similar thing happened to me with my personal Azure spend, but I felt they handled it much better simply by communicating early and often when there was a problem processing payment. I had time to respond and fix my subscription, so I stayed a happy customer.
Sorry, obviously you are not the kind of customer that the three big players care about.
Also, I hope you could show real data points for the comment regarding Hetzner instead of just putting a very questionable claim here.
The general point I was trying to make is not an advertisement of particular hosting provider, but the fact that traditional hosting providers are totally fungible. If tomorrow this company goes bonkers and starts doing stupid things, then I just migrate to OVH, DigitalOcean, Vultr or any other competitor on this market. But unlike traditional hosting providers, there is no market among big cloud providers, as they are not fungible on the customer API level, so each of them is actually a monopoly. And monopoly is generally no good for customers. The rest can be deduced from this principle.
And for the bigger fish, if it's me, I'm one to push for complete containerization and orchestration beyond simple DBAS service for PostgreSQL, depending on needs for scale. Which absolutely means switching can be easy enough.
The only advantage the big cloud providers have is the services for the lower-middle tier customers.
https://awstip.com/how-to-make-terraform-truly-cloud-agnosti...
And even if I don't, I imagine rewriting a terraform workflow is probably easier than taking cloudformation code and then rewriting it into whatever the equivalent is in google or microsoft land. Atm I'm pretty happy with aws and don't see myself moving but I like to have the option if needed.
It's funny that AWS support isn't super great absolutely, but relatively boy their support is amazing. They will at least acknowledge there was an issue on their end.
YES! Everyone should read this. Google Cloud will shutdown your servers for the slightest stupid reason. NEVER EVER run any production apps with Google Cloud. -
"gaslighting that the customer is wrong, gcp had no issues"
YES this is my experience except in my case they didn't gaslight me and instead avoid giving a resolution. -
I run a business that hundreds of paying customers (ecom stores) relies on and I'm a 4 yrs customer with Google Cloud.
They shutdown all my servers last Friday for the slightest stupid reason and don't give a fuck to rectify things fast. 3 days now and they still haven't gave me a resolution.
On paper, my servers were shutdown for at least more than 72 hrs and it's still ongoing.
Context: https://www.onvoard.com/blog/our-production-servers-was-susp...
If you are going to to set up that infrastructure you could just use an mbtiles file which has been around for years.
The interesting thing to me is that this stuff is all built on the open source technology of mapbox, and it seems like a real threat to large parts of their business model. Interested to see how it plays out.
As most storage systems like S3 aren't free and have per-request fees, the price is pretty comparable to this CDN deployment.
Protomaps is very intentionally built with little in common with Mapbox; the main shared parts are using the same Protocol Buffers vector tile format, because there's no reason to write another one; and compatibility with the fork of Mapbox GL 1 (MapLibre GL). See https://protomaps.com/docs/faq#mapbox
In my work we are looking at switching from mbtiles hosted with tilserver-gl(https://github.com/maptiler/tileserver-gl) to pmtiles to remove a server process. But we were self hosting already and we are already using maplibre-gl 2.
I can see why the implementation in the blog post would be better for high traffic deployments (ours isn't). It also points out to me I don't understand how a CDN would handle range request for hosting the pmtiles file directly, it probably doesn't?
As far as the mapbox stuff,in my mind, pmtiles is a direct competitor (successor) to the mbtiles format, which was a revolution in comparison to everything that came before it. A successor I welcome because it makes it even easier for me as a developer to self host and not be dependent on a SaaS to run my maps.
The modern opensource map stack wouldn't exist without mapbox and I'm personally grateful to them for that. Most people who use pmtiles will use mapbox's opensource style spec to style them, and descendants of their open source code to render them. But as a developer now its an obvious choice to not use their services after years of using them.
However I'm not doing high traffic stuff and they never made much money off me anyway.
Protomaps actually has its own vector renderer different from Mapbox GL or MapLibre at https://github.com/protomaps/protomaps.js . It does use a handful of low-level Mapbox JavaScript libraries, but otherwise was consciously developed to be 100% separate from existing Mapbox rendering and styling code, and has an objectively inferior (Leaflet) user experience.
In practice, most serious uses of Protomaps are now using MapLibre GL, so there will be more focus going on that in the project going forward.
The biggest danger with Open tiles is a basemap is the gateway to other data services with higher costs and an easier path to a defendable technical moat. Swapping a basemap can literally be a 10 minute job
(Ideally I'd like to take a sane style, tweak some things like making paths clearer and offsetting the text labels, then making tiles. The Thunderforest maps are exactly what I want, but tiny and local and self-hosted.)
In terms of self hosted maps for outdoors use, I have some open source repos from a few years ago that may help with that. [0] is a style based on the openmaptiles vector tile schema for outdoors purposes. I believe that readme has some overall instructions, plus other repos in the org are for making data. (Nowadays planetiler is probably the best way to make OSM vector tiles though)
I agree it's very reasonable to have highly zoomed small area stuff, I just seem to be missing the gap between the OSM data and the tiles. I'll give that a read, thank you!
The individual software components often have alternative with a similar scope. So if you don't like a choice headwaymaps made, browse around.
The data sources are mostly "unique", i.e. everybody downloads from the pages (Geofabrik, Who's On First, etc), so not much to gain here.
Editing styles has some alternatives, but the OpenSource editors are far away from the quality of the Mapbox editor. Maputnik or editing the 1000+ SLOC JSON by hand are the way to go, imo.
Personally I use GeoFabrik to download OSM extracts → osmconvert to extract the smaller bounding box I am interested in → tilemaker to render vector tiles to individual .pbf files I can serve like it's 1999. The bounding box extract is not necessary, but it's much faster if you need to tweak things in tilemaker. Both tilemaker and osmconvert are packaged for at least Debian out of the box, so setup is easy enough. Rendering a decently sized metro area takes < 30mins with this from scratch of compute, < 5min with the bounding box extract.
Note that adding icons (sprites) or fonts is extra work that comes on top. And while the tools themselves are great, there's still a lot of gluing/plumbing/fitting things together that you'll need to do. If headwaymaps works for you, it's probably the easiest choice.
FWIW I generated all the tiles up to zoom 18 for France (which is the best mapped country as far as OSM go), it represented about 300 GB of data.
You will need a big SSD, 16 GB ram for a big country, 32 GB for Europe, I think you can do the world with 64 GB but ofc more is always better. Count a few weeks to generate everything, probably less if you have a very good computer / server (mine was quite old, 2012ish I think).
https://protomaps.com/docs/pmtiles
Looks like protomaps supports up to zoom level 14 for free:
https://protomaps.com/docs/faq#openstreetmap
I also maintain open source tooling for anyone to replicate and extract OSM on-demand, as well as a free download portal:
I note that:
> OpenStreetMap ... standard tile layer ... openstreetmap-carto ... is based on dynamic rendering of raster images, instead of vector tiles that can be customized on the client.
so, does OSM really not make vector tiles available? That's too bad.
Basically they want you to host your own tile server using the OSM dataset. There are also commercial offerings that do this for you, but not for free.
Paul Norman has a project called Tilekiln to adapt vector rendering for this use case on OSM.org: https://github.com/pnorman/tilekiln
Openstreetmap doesn't really do a lot for hosting maps for third party websites. You would use Mapbox, maptiler or other suppliers for that and libraries such as mapbox/maplibre, openlayers, leaflet etc. that can render either bitmap or vector maps.
The trick with protomaps is that instead of deploying gazillions of tile files, you upload a huge single file with all the vector content inside and then use lambda functions to extract tiles from that file. And then you use caching and CDNs to to make sure you don't have a lot of compute overhead . So, the API looks like a normal tile server. The data deployment process boils down to uploading a new file and your usage data is a little bit of compute for the tiles your users ask for and a networking cost related to using a CDN.
So, that adds up to a lot of savings potentially. At least, as long as commercial providers don't lower their cost. Obviously, they are free to do similar things technically.
A more obvious quality issue for example: on their demo, Arabic text renders wrong (left to right instead of right to left, it'd be like printing kroY weN instead of New York)
A few years back, I built something to do reverse geocoding based on Google Maps's prices. I never actually released it because I wasn't confident the coverage was good enough.
I guess it might be worth dusting it off and seeing if someone finds it useful.
The solution as described in the post is for serving tile archives, and where you get the tile archive is up to you - I have a commercial offering (and am working on an open source one too), and there's various other FOSS projects for tile creation.
If you want fancy features like being able to use a UI to make custom map styles, vehicle routing and satellite overlay, then MapBox and Google are still your friend.
A small detail: I don't believe this is the absolute cheapest way to deliver map tiles. Renting an unmetered bandwidth server is always going to be the cheapest way to host content, but unmanaged servers don't give you SSL termination, infinite storage, or an edge cache.
Protomaps is designed as the right compromise between self-hosted operational+development costs and SaaS-like delivery.
Can I still use this? Or do I need felt
Very knew to make sorry
Protomaps doesn’t limit you to any particular type of tiles, it’s just a format which allows you to read tiles out of a single file with HTTP range requests.
The Mapbox repo has an older version of tippecanoe; there's a newer version actively being improved by Felt at http://github.com/felt/tippecanoe , and they've also funded my addition of the Protomaps format (PMTiles) as a direct output. No conversion step required anymore!
The catch is that you have to host it yourself (which is pain if you want to update it - otherwise it's just upload and forget).