Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert GeoJSON to vector.pbf (Protobuf)?

I have a big GeoJson file and I need to convert it to the vector format that can be loaded by the Mapbox. I need to have an external file, so I can't use Mapbox Studio for uploading and converting the data.

Currently I found https://github.com/mapbox/tippecanoe tool, but it converts GEoJSON to MBTiles (SQLite format). I think a can't use it for my map. As I can see from all the examples of the Mapbox service - it uses a XXX.vector.pbf (protobuf) format (small and fast). So the question is - how to get a Protobuf vector file from the original GeoJSON ? Thanks!

like image 941
Jack Owels Avatar asked Oct 05 '17 08:10

Jack Owels


People also ask

How do you convert PBF to GeoJSON?

You can use QGIS to load your . pbf file and once you drag and drop the file on QGIS the data will be displayed as a layer on map, then: Right click on the layer > Save as > Change format Format: GeoJSON , choose the layer name and set COORDINATE_PRECISION=5 (recommended). And done!

What is vector PBF?

Format. Vector tiles are encoded as Google Protobufs (PBF), which allow for serializing structured data. For clarity, Mapbox Vector Tiles use the . mvt file suffix. The specification details are largely structured around the rules implemented in the base .


1 Answers

Tippecanoe is probably the right answer: it generates a ton of .pbf files, and bundles them into a single .mbtiles file. Usually you then pass that .mbtiles file to a vector tile server (there are heaps), or upload it to Mapbox or something.

If you want to explode out the .mbtiles file, you can use mbutil.

Finally, if you want to translate GeoJSON directly into protobuf format (different from the Mapbox vector tile format, I think), you can use GeoBuf.

like image 163
Steve Bennett Avatar answered Oct 06 '22 13:10

Steve Bennett