Live data from Hacker News

Protomaps – A free and open source map of the world

protomaps.com

131–140 of 169 posts

Re: Protomaps – A free and open source map of the world

#131

These PMTiles don't seem to work well with users behind corporate proxies. The proxy must have to download the entire files before releasing it. Not making a nice user experience. I wonder if there is a way around this?

Switch to POST request?

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.

Re: Protomaps – A free and open source map of the world

#132

Earlier quoted context omitted.

So, you're still going to be better off with a tiled overview sort of system. 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.

I'm a total noob to all this, so I totally get if you can't help--it's not your problem, no worries! But would you be able to share any code to convert this, or any of the data?

I can't share this data, but there are a couple of ways to get started:

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.geojson

Re: Protomaps – A free and open source map of the world

#133
post #123
post #82

I just used their pmtiles tool to grab a map of just the area around Half Moon Bay, south of San Francisco. 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,-…

I turned this into a demo: https://simonw.github.io/hmb-map/ and a blog post: https://til.simonwillison.net/gis/pmtiles

Beat me to it. I was working on this last night but had to sleep before writing it up. I was trying to use parcel as a bundler and was thrown because whatever dev server it uses doesn't seem to support HTTP range requests properly. I was getting "invalid magic number" on the client side.

Re: Protomaps – A free and open source map of the world

#134
post #63

Earlier quoted context omitted.

Thanks. I'm OK with a single layer just showing the outlines of coastlines and regions, including the names of regions. I think a suitable simplified world map could fit all this in SVG. 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…

I would expect border length scales with the square root of country area, so smaller countries have disproportionally longer borders than larger ones. 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…

Countries with coastlines, especially with fjords, have disproportionately longer borders. Scaling constants aren't going to do it for something like Chile.

Re: Protomaps – A free and open source map of the world

#135

Earlier quoted context omitted.

That's really cool. Cloud be really use full for local businesses. They often embed Google maps, but I feels like having a map from the local are would be sufficient, and cheaper.

Wouldn’t they need to keep updating this from time to time to stay current? That would likely kill any savings pretty quickly.

It depends what you use it for. I plan to use it for blog posts where I show the track of where I walked. I actually like that the map won't update. It wouldn't make sense to show me walking across a map of the future, would it? It's a record of the past and the map should be frozen just like the writing.

Re: Protomaps – A free and open source map of the world

#137

For me the most interesting part is “PMTiles”: > 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. > PMTile…

So, could PMTiles be used as a cheap/dirty/fast way to host other forms of geospatial data that isn't strictly "map tiles"? Such as a large-ish, infrequently updated POI database?

If the geometry is points/lines/polygon/multi* + properties on the features, yes. (In other words, if it's representable as geojson), with the caveat that it's more for viewing and less for analysis.

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.

Re: Protomaps – A free and open source map of the world

#139
post #82

I just used their pmtiles tool to grab a map of just the area around Half Moon Bay, south of San Francisco. 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,-…

I did the same and got a map of Gran Canaria which is 15MB! And it's not like a user is ever going to download the entire file. It's really quite cool and I'm quite excited to put maps on my static site.

Re: Protomaps – A free and open source map of the world

#140
post #124

Whats the relationship between this and openstreetmaps? Is OSM the "runtime viewer" and Protomaps is the maps and query data?

Open streetmap is a database that you can use to produce maps from. Open streetmaps the organization does not produce maps as a service directly. They do provide a map editor, which of course also renders the tiles and they host the central database that people contribute to with that editor. But their tiles are not distributed via APIs or dumps otherwise. The only thing that they provide is a database dump in various formats.

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.

Post reply on HN