Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to get a subset of layers using pmtiles extract #164

Open
eyeseast opened this issue Apr 25, 2024 · 2 comments
Open

Add ability to get a subset of layers using pmtiles extract #164

eyeseast opened this issue Apr 25, 2024 · 2 comments

Comments

@eyeseast
Copy link

If I'm using pmtiles extract to get a piece of a larger tileset, sometimes I might not want every layer available. Could extract also filter layers or give me a way to include or exclude layers?

The API could look something like this:

# only extract buildings and county boundaries
pmtiles extract input.pmtiles output.pmtiles --bbox "..." --layers "buildings,boundaries_country"

# get everything except water
pmtiles extract input.pmtiles output.pmtiles --bbox "..." --exclude-layers "water"
@daniel-j-h
Copy link

I ran into similar use cases where I started out with the .pmtiles matching the default basemaps style https://github.com/protomaps/basemaps but then wanted to slightly deviate from it. For example when you want a very simple overview map as shown below where we only need to style the water, earth, boundaries layers. At the moment I simply use the .pmtiles with much more data in them as needed by the simple style.

Two more considerations here

  • In theory it should be possible to e.g. use ogr2ogr to convert to mbtiles and do the filtering there. In practice only most recent gdal-bin packages contain the pmtiles reader, tho.
  • One question could be: should this layer filter be a command line flag for the extract sub-command or should there be a pmtiles filter sub-command, or maybe both?

extract-layers

@johnnagro
Copy link

johnnagro commented Oct 3, 2024

FWIW I tried doing this with the tile-join command from tippecanoe like this:

tile-join -l water -l earth -l boundaries -o output.pmtiles input.pmtiles

But it doesn't seem to succeed when using a full protomaps basemap pmtiles file (~120gb). Tries for several minutes then crashes on alpine linux and osx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants