go-pmtiles icon indicating copy to clipboard operation
go-pmtiles copied to clipboard

pmtiles does not list layers, but shows <object...>

Open guerda opened this issue 6 months ago • 5 comments

I wanted to inspect some pmtiles files which layers they have available, as styles refer to the source layers. Unfortunately, pmtiles show does not list the layers correctly, but only says vector_layers <object...>. This is rather unhelpful.

I was able to use pmtiles.io, but it would help to support it in the cli, too.

h1. Steps to reproduce

  • Download or create a pmtiles file (e.g. https://pmtiles.io/protomaps(vector)ODbL_firenze.pmtiles )
  • pmtiles show "protomaps(vector)ODbL_firenze.pmtiles"
  • Look at the output of vector_layers

Version of pmtiles is 1.28.0, see output below

$ pmtiles version
pmtiles 1.28.0, commit 9a400a68d039dfa71e1706f154139558cbd1999f, built at 2025-04-30T11:16:03Z
$ pmtiles show protomaps\(vector\)ODbL_firenze.pmtiles
pmtiles spec version: 3
tile type: mvt
bounds: (long: 11.221144, lat: 43.745121) (long: 11.287543, lat: 43.789306)
min zoom: 0
max zoom: 15
center: (long: 11.254343, lat: 43.767213)
center zoom: 0
addressed tiles count: 92
tile entries count: 92
tile contents count: 92
clustered: true
internal compression: gzip
tile compression: gzip
pgf:devanagari:name NotoSansDevanagari-Regular
pgf:devanagari:version 1
planetiler:githash 797e250f237e9ed5649b6800da902d1e033e1bfe
type baselayer
version 3.7.1
planetiler:version 0.8-SNAPSHOT
vector_layers <object...>
description Basemap layers derived from OpenStreetMap and Natural Earth
name Protomaps Basemap
planetiler:buildtime 2024-08-01T09:31:28.786Z
planetiler:osm:osmosisreplicationseq 104325
planetiler:osm:osmosisreplicationurl https://planet.osm.org/replication/hour/
attribution <a href="https://www.openstreetmap.org/copyright" target="_blank">&copy; OpenStreetMap contributors</a>
planetiler:osm:osmosisreplicationtime 2024-08-07T04:00:00Z

guerda avatar Jun 23 '25 11:06 guerda

You can use --metadata to see the entire vector_layers object.

Making pmtiles show print that outputs possibly hundreds of lines of JSON which isn't always helpful.

bdon avatar Jun 23 '25 14:06 bdon

Great, haven't seen this flag mentioned. Would it be useful to mention this in the output of the show command then?

I haven't found this flag in the docs, I think it would be great to explain it there.

guerda avatar Jun 23 '25 15:06 guerda

This is documented in both places:

pmtiles show <path>


Flags:
  -h, --help                 Show context-sensitive help.

      --bucket=STRING        Remote bucket
      --metadata             Print only the JSON metadata.

https://docs.protomaps.com/pmtiles/cli#show

bdon avatar Jun 23 '25 15:06 bdon

Sorry, I missed that, thank you.

I meant to change the output from vector_layers <object...> to something more explicit? Like vector_layers details available with --metadata? If not, we can close this. Thanks for your fast replies!

guerda avatar Jun 23 '25 15:06 guerda

Maybe we can change the description of the flag to "print all metadata as JSON, including vector_layers and other nested objects"

bdon avatar Jun 23 '25 16:06 bdon