Protomaps – A free and open source map of the world
protomaps.com
protomaps.com
I grabbed the latest macOS Go binary from https://github.com/protomaps/go-pmtiles/releases
I found a rough bounding box using http://bboxfinder.com/#37.373977,-122.593346,37.570977,-122....
Then I ran this:
pmtiles extract https://build.protomaps.com/20231023.pmtiles hmb.pmtiles \
--bbox=-122.593346,37.373977,-122.400055,37.570977
The result was a 2MB hmb.pmtiles file which, when dragged onto the "drop zone" on https://maps.protomaps.com/ showed me a detailed zoomable map, with full OpenStreetMap metadata (airport polygons etc) - all the way down to individual building outlines level.All that in 2MB! I'm really impressed.
My file is here: https://gist.githubusercontent.com/simonw/3c1a5358ca8f782f13...
[1] https://maps.protomaps.com/builds/
Edit: re-reading top comment it looks like they're using a daily file so you'd just have to create a cron job
But the concept is great to get a map for a project
Also to note, the emergence of PMTiles coincides DuckDB spatial query support will unlock a lot of innovation. The ability to query and process large geoparquet files and quickly stream them into baked PMTiles unlocks a lot of really compelling use cases.
gpq convert Cairo_Governorate.parquet --to=geojson | tippecanoe Cairo.geojson -o Cairo.pmtiles
* https://cloudnativegeo.org/blog/2023/10/where-is-cog-for-vec...
Mapbox is a venture-backed company with a SaaS business model, and has never been open source in total - it used to be open core with a FOSS frontend and proprietary backend. This SaaS model is absolutely the best way to fund huge companies and give investors a return. Mapbox has also done the bulk of innovation in open source web mapping over the past 10 years - the Protomaps project uses MapLibre (fork of Mapbox GL 1.0) and the MVT tile format. Both required teams of full-time developers - easily tens of millions in salaries and stock - and they have given away version 1.0 for free as a gift, even though 2.0 is not open source.
The ideal software economy is one in which innovators capture a good portion of the wealth they create. This is why it's important for Protomaps to focus on use cases underserved by SaaS, instead of just being a cheaper map API. The sibling comment on wildfire mapping https://news.ycombinator.com/item?id=37989059 is a good example of the applications I want the project to support.
Beg to differ, the ideal software economies maximally empowers end-users at the absolute minimal cost. Innovators can and should leave substantial cash on the table. They should see themselves as stewards of a public good.
I think that goes a bit far. They don’t absolutely _have_ to. It’s just nice if they do.
Private ownership economy doesn't work for zero marginal cost products even in theory. It's a huge waste of our resources and a big hinderance to progress.
See, for instance, "How The Post is replacing Mapbox with open source solutions" https://www.kschaul.com/post/2023/02/16/how-the-post-is-repl...
OSM is the biggest community effort - NGO, volunteer, corporate, etc - to solve data quality in GIS. The participants do everything to improve quality from individuals walking around with GPS devices to companies launching low earth orbit satellites into space and self-driving cars in the ground with AI error detection.
There is a more corporate and afaict anti-google effort more recently by tomtom and google competitors (Microsoft, meta) called Overture, which seems to be attempting a more closed and big corporate governed fork & ecosystem replacement of OSM, even if they phrase it as complementary. Your questioning of OSM-as-misinformation seems interesting in the comparative context of alternatives like Google Maps, Apple Maps, and Overture.
None of the above. People might just be curious and interested!
Thanks for sharing all that. I didn't know much about the quality. Much crowd-sourced data has accuracy problems.
Because nothing meets that standard, it's not an applicable measure of quality. Also, it tends to lead to binary thinking: 100% or null.
But we live in a world of less than 100%, and there is a lot of variation: Five nines, 80%, datasets with just a few valuable records, etc. That's where the real-life questions are.
If you spend any time on either OpenStreetMap or Google Maps in the rural US, and you are very likely to find both missing streets, and streets that have been completely hallucinated out of nothing -- mostly because they were both originally sourced from the US CENSUS TIGER data -- a US govt data set that tends to be full of errors.
OpenStreetMap contributors of often improve these issues over time (though it largely depends on if the area you care about has some sufficiently dedicated mapper).
It would be great to be able to download only diffs and apply them to a daily, weekly, monthly baseline.
Today 10/23 is 107GB.
https://maps.protomaps.com/builds/
I'll update the documentation page today.
(is it like, your torrent client will silently update files, and if you dont want to update anymore you need to pause? can you still seed if you dont want to update?)
Does this serve decentralized "web app" through bittorrent?
Do I need your client to seed it, or can something like qbittorrent seed it?
Will I seed only the last version of the page or all versions? Can someone download an earlier version or list all past versions?
Basically what I did was set up 'qbittorent' client to watch the openstreetmap rss weekly torrent feed. when it downloads a new pbf file, it runs this script I made at https://github.com/acalcutt/PlanetilerTorrent , which was based of the osm torrent creation process.
The script creates pmtiles and mbtiles using planetiler, then makes torrent and starts seeding them in qbittorent.
In qbittorent I have options like how long I want to seed for (30 days), what do do when done seeding (Delete the files) and also speed controls so I can limit bandwidth during my working hours.
I have this running on a old laptop with 2TB nvme/64GB memory. It seeems to work pretty well so far. It would be nice if my internet speeds were a little better for initial seeding, but at least the torrents share the load with other people who are downloading/
https://www.bittorrent.org/beps/bep_0046.html (discussion on HN at the time, https://news.ycombinator.com/item?id=12282601)
I was asking like, how widely is BEP-46 adopted in practice. It's a spec from 2016!
https://www.bittorrent.org/beps/bep_0046.html (discussion on HN at the time, https://news.ycombinator.com/item?id=12282601)
It would be interesting to see a cost comparison: recommended hosting setup vs Google Maps, and at what point the line intersects.
It seems to be a really attractive way of self-hosting maps that don't have to be 100% up to date and are only used in a specific region. "Recompiling" that file once a year and uploading it to a static file hoster would be an easy process with very little external dependencies.
Edit: Found the official download link[1] for the whole world, which is a bit over 100 GB. So I guess the answer to my question would be "hundreds of MB to a few GB", which seems totally fine.
(Representative numbers from my runs)
If you read the Protomaps docs it explains how to cache the requests on Cloudflare CDN so you only have to pay for each tile request once per cache period. It's quite cheap.
Edit: previous submission title for Protomaps: Serverless maps at 1/700 the cost of Google Maps API
> PMTiles is a single-file archive format for pyramids of tiled data. A PMTiles archive can be hosted on a storage platform like S3, and enables low-cost, zero-maintenance map applications.
> PMTiles is a general format for tiled data addressed by Z/X/Y coordinates. This can be cartographic basemap vector tiles, remote sensing observations, JPEG images, or more.
> PMTiles readers use HTTP Range Requests to fetch only the relevant tile or metadata inside a PMTiles archive on-demand.
> The arrangement of tiles and directories is designed to minimize the amount of overhead requests when panning and zooming.
Previous iterations of this on the vector side have either been a ton of small files(pbf) or a large file that needed a front end to serve the individual tiles (mbtiles).
At this point, you can take an OSM dump and convert it to a country level basemap in minutes on a stout machine, or hours for a continent, which you can then self host on a plain old web server with a custom style sheet.
I've made an even easier path which is to just extract the relevant tiles from a daily build: https://docs.protomaps.com/guide/getting-started
This can take seconds to minutes for small-medium areas and doesn't need a powerful computer at all. The drawbacks are that the build is only daily, and the lower-zoom tiles aren't clipped so include extra information beyond your specified area.
I'm looking at this currently for a couple of clients, and I think that for what we're doing -- we're going to wind up serving both a view and analysis version separately.
We were taking daily CSV files, turning them into vector tiles, syncing them with S3, and displaying in mapbox-gl map. The biggest cost was S3 file operations. We had to aggressively cluster to reduce our cost down and got to a point where the tiles numbered ~75,000. At the frequency we wanted to update this was costing $500/mo in S3 ops.
Now we process the files into a single PMTiles file, deploy that one file and cut the costs down to pennies.
For a map that we make public, it was incredibly enabling. You can checkout the Canadian hotspot data for all of 2023 if you're curious: https://lens.pathandfocus.com
It's essentially what the internal layers are in the base layer -- there are land use, buildings, transit, physical, and border features that are combined with a stylesheet to make the base layer map tiles.
There are some subtleties for packing the overview data for the wider zooms, and what happens when you have tiles that are too big because of number of features or metadata size -- where you can drop on density or coalesce on density.
for pretty much any geospatial source you can convert to .pmtiles via GDAL[3] and tippecanoe (.shp .gpkg ...) | ogr2ogr -> .geojson | tippecanoe -> .pmtiles
for OpenStreetMap data there's planetiler[4], and and openmaptiles[5] styles that work with Maplibre
with those combinations you've got a great start to something you can host for pennies on AWS S3+CloudFront or Cloudflare R2, with an open source data pipeline
[2] https://github.com/felt/tippecanoe
[4] https://github.com/onthegomap/planetiler
[5] https://openmaptiles.org/styles/
ps I find GDAL/ogr2ogr documentation pretty hard to parse, as an example to get you started
ogr2ogr -f GeoJSON counties.json -t_srs EPSG:4326 -nln counties -sql "SELECT STATEFP, COUNTYFP, NAME FROM tl_2022_us_county" /vsizip/tl_2022_us_county.zip
https://www.census.gov/geographies/mapping-files/time-series/geo/cartographic-boundary.htmlpmtiles extract INPUT.pmtiles OUTPUT.pmtiles --bbox=BBOX --maxzoom=Z --dry-run
--dry-run will output the total size of the final archive without downloading any tiles, so you can adjust the maxzoom from the default of 15 (for basemaps) until it fits under your limit
Does anyone have a good introduction to paint a high level picture of this, so someone like me can navigate?
[1] https://www.etsy.com/nz/listing/1541532385/dusseldorf-print-...
Therefore I'm a bit proud that a tiny part of the fast and memory-efficient import pipeline is using code from GraphHopper :) (see Acknowledgement)
Little blog post here: https://schof.co/moving-over-street-art-cities-to-pmtiles-an...
Also, is the data open source? The FAQ says the code, etc. is open source, but doesn't mention data:
> Is Protomaps open source? / Yes! All core software libraries and formats are open source under permissive licenses, including: ...
Mostly people either generate their own tiles from this (using a variety of OSS and proprietary tools available for this) or use companies such as mapbox, maptiler, etc. that do this for them. Typically the commercial options bill using a metered per request model. This can make using maps quite expensive. Ever since Google raised their prices substantially a few years ago, things like Mapbox have become a lot more popular. Mapbox and similar products are also not cheap.
What pmtiles does is dramatically lowering the price and complexity for self hosting your own maps to basically the raw CDN network cost plus a small amount of overhead for storage and computation. The tiles are generated using e.g. lambda functions from a single pmtiles file on demand and then cached in the CDN. Any subsequent loads of the same tile are cache hits. So, especially for busy websites and apps, the savings can be substantial.
Not a big deal with terabyte storage on mobile these days.
If you want to embed a map file in your app, you can already use MBTiles for that. A MBTile is conceptually like a PMTile, in a way, but it's a zip file full of the tiles with a SQLite database. MapBox/MapLibre already supports local MBTiles. You can serve them online, but of course you need something taking in the x, y z coordinates and serving back the tiles.
Most of/the entire value prospect of PMTiles is you can dump a single multi GB files on a CDN somewhere, and clients can just request a little slice of it. No servers or any logic required (besides a CDN that supports byte-range headers).
I am hoping that MapLibre native will one day will support sources that are PMTiles. `source: pmtile://my.cdn.com/bigOleFile.pmtile` and then it just works as if pointing at a traditional slippy tile source.
If not, then probably it can be done by additional proxy that will convert range headers to GET params. But TBH corporate proxy in this context doesn't seem to work properly. For example, all other header-based authentication should be broken if proxy doesn't respect additional headers.
AFAIK it is illegal to distribute accurate geographical data about China without their authorization.
You can distribute the one that is slightly inaccurate, such as what provides google maps or apple maps for non chinese users
The reason I want that is, almost all humans have a GPS device in their pocket. You could easily get your approximate location from this, even without cell service. Implementation could be a PWA.
The amount of map data for any reasonable area is going to be too large for a PWA, though it would technically be possible to do with existing map viewers and this format. (Eg maplibre or leaflet)
edit: Initially underestimated so did some calculations below
Key Data Points for Estimate of SVG Size
- Radius of Earth: 6371 km
- Surface Area of Earth: 510e6 km^2
- Approximate Number of Countries: 250
- Land Area of Earth: 29% of Surface Area = 150e6 km^2
Corrections and Estimations Based on Average Country Size - Average Land Area per Country: 150e6 km^2 / 250 = 6e5 km^2
- Country Closest to Average Size: Ukraine, with 603550 km^2, or roughly 6e5 km^2
- World Resources Institute Measure of Ukraine Coastline: 4953 km, or around 5e3 km
Assumptions for SVG Complexity 1. Only coastlines matter for the paths.
2. Resolution set at 10 meters.
SVG Data Calculations and Estimates - Coastline Points for Average Country:
- 5e3 km = 5e6 m
- Equals 5e5 X,Y points (at 10m resolution)
- Total Points for All Countries:
- 250 countries * 5e5 points = 1.25e8 X,Y points
- Storage Requirement for Each Point:
- 6 figures per coordinate + delimiters = roughly 15 bytes
- Total Storage = 1.25e8 points * 15 bytes = ~1.875e9 bytes or about 1.875 GB
Even with a simplified approach, we're looking at an SVG that'd be almost 2 GB, just for coastlines at a 10m resolution. Definitely some hefty complexities in play here.What about 1000m resolution? 20 megabytes. Much more achievable.
There also must be more countries smaller than the average country than there are larger ones (https://www.worldometers.info/geography/largest-countries-in... confirms that. Ukraine is 45th of 223, or about 20% down.)
So, I guess yours is underestimating the size.
You probably get a better estimate by using the Ukraine to estimate the scaling constant (√603,550km²)÷4953km and then use a list of land areas to estimate border lengths.
116KB - 5MB for country borders
16MB - 52MB for ~50K city/county level borders based on geoBoundaries
The range of sizes depends on how much custom compression/simplification you put into it. The source files are about 10x bigger, but that's already pretty small.
Topojson might be even smaller though.
Check the repo for details /selfplug https://github.com/SmilyOrg/tinygpkg-data
Well, mostly that it's text / XML you usually have to parse in full and boundaries are data heavy, so if you have anything more than a world map, I don't see that working very well.
In contrast with the OP or GeoPackage, you can query by tiles/range and only extract the boundaries you need if you're zoomed in somewhere. If you use Tiny Well-Known Binary compression, you can also shrink the data quite a bit while keeping the querying capabilities.
But if you only ever need to render the whole thing, topojson is probably the winner as it cleverly encodes only unique borders once, so it tends to be a lot smaller.
And of course if SVG works for your case, go ahead and use it, it's surely the easiest way to render vector gfx in the browser :)
FWIW, I've got an official 900MB geojson of borders from a large unnamed multinational NGO type that's particular about their mapping.
At z=4, or 600m resolution, it's a 2.5MB pmtiles, at z=10 (10m resolution) it's 83M.
That's just the ADM0 borders, adding local borders would obviously increase the size.
1) Just use the overview tiles from the global protomaps dump (OSM source). The getting started guide can walk you through some of it: https://docs.protomaps.com/guide/getting-started but you'd want to use the pmtiles tool to extract the widest zooms from the global dataset.
pmtiles extract https://build.protomaps.com/20231023.pmtiles overview.pmtiles \
--maxzoom=4
Then see the intro to pop it in a viewer, or it's a few dependencies and a style sheet and it pops into OpenLayers, Leaflet or MapLibre for a viewer. There may be some extra layers there, but at wide zooms there shouldn't be much data there. (e.g. buildings)2) If you have/find your own data, use Felt/tippecanoe to convert it.
tippecanoe -z4 -o overview.pmtiles data.geojsonI really appreciate you showing me how to do that. Thank you very much!
I don't fully understand LLC except that they protect owners from company liability.
Just trying to figure out what the goal for this company is.
They seem to be explicitly noncommercial
The difference from other commercial vendors is the focus on a complete, easily deployable solution - the hosted API is meant for non-commercial and light commercial use, instead of being the main product offering, to avoid the incentive trap of locking-in paying users to the API.
A related concept is the Community Right to Replicate: https://2i2c.org/right-to-replicate/
I must disagree. Even in the early days, even though that was the intended use of the .com TLD, it has always actually been used as the default TLD instead of the .net TLD.
I really hate it, but whenever I see a .com I have never, and will never assume it has some sort of commercial angle.
I'd go so far as to say "especially in the early days". When I got my first domain in ~'92, it was just a personal domain, and they wouldn't let me get a .net because I wasn't an ISP, or a .org because I wasn't a non-profit. And .edu was right out.
Said sponsorship is a requirement for using the pre-hosted files for commercial uses in a SaaS-like manner.
But some of the wording in the faq is a bit confusing. E.G. There's a whole section about "Why don't you just sell plans for the hosted API?" right after detailing how to sign up for said plan for the hosted API.
The hosted API is "free" in the sense that there are no tiers. The API costs me money to run, which is why I require a GitHub sponsorship for commercial use. This is ideal for use cases where deploying your own tileset is impractical.
If you are using the hosted API heavily then it makes sense for you to "graduate" to deploying it yourself.
A 100% independent software project
Protomaps is a self-funded, solo developer project with a mission to make interactive cartography accessible to hobbyists and organizations of all sizes. An essential part of that mission is publishing open source software under commercial-friendly licenses.
You can support my full-time work on Protomaps in a few ways: * Downloading the open source world basemap tileset with a support plan on GitHub Sponsors. * Paid development of open source features.
LLCs in this context signal "This company has no outside investors", because almost every venture-backed technology company will be organized as a C Corporation instead.
I am choosing to run this open source project through a commercial company - that enables me to have a bank account, use GitHub Sponsors, pay others for work, and enter in support and development contracts with other companies and the public sector. Non-profit foundations like US 501(c)(3) aren't practical to create for solo developers.
Immediatelly getting downvoted. All I'm saying is that official map boundaries these days should be used.
Because I can again not post because too fast here my clarification: I mean official not commercial or proprietary
This is exceedingly useful for so many use cases.
E.g. internal tools that display locations of assets, system statuses, webpages that display store locations, and so forth.
Plenty of use cases where the costs for Googles APIs would exceed the dev costs for implementing something like this.
Why isn't my time zone highlighted on the world map?
> In early 1995, a border war broke out between Peru and Ecuador and the Peruvian government complained to Microsoft that the border was incorrectly placed. Of course, if we complied and moved the border northward, we’d get an equally angry letter from the Ecuadorian government demanding that we move it back. So we removed the feature altogether.
> The time zone map met a similar fate. The Indian government threatened to ban all Microsoft software from the country because we assigned a disputed region to Pakistan in the time zone map. (Any map that depicts an unfavorable border must bear a government stamp warning the end-user that the borders are incorrect. You can’t stamp software.) We had to make a special version of Windows 95 for them.
— https://devblogs.microsoft.com/oldnewthing/20030822-00/?p=42...
The Protomaps project encompasses the generation of basemap PMTiles and the ecosystem for delivering them to clients. It supplies a standard daily build from OpenStreetMap, and since the generation is open source it can be customized to conform with your specific requirements.
Manipulation can and does happen with non open source data. Just ask any politician. You should be thankful to developers who did a great service for free. If something is incorrect because of conflicts - the world will sort it out eventually. It is not developers job.
PS - I did not downvoted as I never downvote any posts.
Sounds like a good policy.
Pray tell, which official map boundaries should be used?
The whole problem being that officials disagree of course.