5
  1. *.pbf("Protocolbuffer Binary Format") is primarily intended as an alternative to the XML format.
  2. There are two formats of *.osm.pbf and *.vector.pbf. What tools can I use to open these files? (I know JOSM can open *.osm.pbf files, but it can't open *.vector.pbf files.)
  3. If I want to write own *.vector.pbf files in Mapbox, how do I work for that?

Thanks!

kevin4z
  • 349
  • 4
  • 12

2 Answers2

7

The Vector tiles used by Mapbox are serialized as Protocol Buffers. Protocol Buffers allow you to efficiently compress the vector data inside the tile.

The Mapbox Tile Specification is available on github. Esri has also adopted the same specification for their products.

You can find a list of parsers, renderers & CLI utilities here: https://github.com/mapbox/awesome-vector-tiles

In the common scenario, you can use mapbox-gl-js to render the vector tiles on the client. To generate vector tiles, you can use Mapbox Studio. This will require uploading your data online in the Studio. You can also use Mapbox Studio Classic (the older version) to generate the tiles locally.

Internally, Mapbox Studio uses the tilelive API, so you can programatically generate the tiles. In the list above there are other good alternatives as well.

kmandov
  • 3,130
  • 16
  • 15
7

Regarding question #2, extracting PBF data

Using GDAL's ogr2ogr is the easiest method (I found). Given a file named 1583.vector.pbf decode it to a, for example, shapefile (folder) named output:

# cmd   show prog.  output format     output name     input name
ogr2ogr -progress -f "ESRI Shapefile" output          1583.vector.pbf 

Regarding question #3, creating PBF data

Use the same command as above but swap the input/outputs and output format:

# example source: https://gdal.org/drivers/vector/mvt.html
ogr2ogr -f MVT mytileset source.gpkg -dsco MAXZOOM=10
Cyrille
  • 3,427
  • 1
  • 30
  • 32