vt2pbf
Python port of JS vt-pbf to Encode Mapbox vector tiles to binary protobufs in python. Right now available only version 2 of mapbox vector tiles spec
Install
vt2pbf is available on PyPi.
Install using pip.
pip install vt2pbf
Import vt2pbf
from vt2pbf import vt2pbf
Usage
Firstly you need to make a vector tile. You can do it by your own or use some libraries to convert, for example geojson into vector tiles using python port of geojson-vt library - geojson2vt
After you can easily encode your vector tile into pbf:
# build an initial index of tiles
tile_index = geojson2vt(geojson, {})
# request a particular tile
vector_tile = tile_index.get_tile(z, x, y)
# encode vector tile into pbf
pbf = vt2pbf(vector_tile)
print(pbf) # b'\x1a\xfb\x01\n\x0cgeojsonLayer\...'
vt2pbf takes two additional arguments:
layer_nameis a name of encoded layer,default='geojsonLayer',extendis definition of the extent of the tile,default=4096
Additional usage
You also can encode any custom information in pbf by Mapbox vector tiles spec
from vt2pbf import Tile
tile = Tile(extend=extend)
tile.add_layer(layer_name, features=features) # features in vector_tile format (close to vector_tile['features'])
tile.add_layer(other_layer_name, features=features)
pbf_string = tile.serialize_to_bytestring()
print(pbf_string) # b'\x1a\xfb\x01\n\x0cgeojsonLayer\...'
In addition you can parse encoded data from bytestring using:
from vt2pbf import parse_from_string
pbf_string = b'\x1a\xfb\x01\n\x0cgeojsonLayer\...'
tile = parse_from_string(pbf_string)
print(tile.tile_pbf)
# layers {
# name: "geojsonLayer"
# features {
# tags: 0
# ...
Right now you cannot add some additional layers or info to parsed tile, but it will be available in future
Acknowledgements
All the credit of tile encoding belongs to the collaborators of JS vt-pbf.
Metadata
Release files for vt2pbf 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| vt2pbf-0.3.0.tar.gz | 56.9 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| vt2pbf-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 73.8 kB
Release files / vt2pbf-0.3.0.tar.gz
| Download URL | vt2pbf-0.3.0.tar.gz |
|---|---|
| Size | 56.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5414eceb7bf2a02ad9aad8efc596f60822969aa3bdd374b6a1b1204b3c0d0411
|
|
BLAKE2b-256 checksum How to use checksums |
973f7694ce4703a20f90f21e3bcf1691780246a20272b732628f1128b540a9db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 2, 2026.
Transparency logRelease files / vt2pbf-0.3.0-py3-none-any.whl
| Download URL | vt2pbf-0.3.0-py3-none-any.whl |
|---|---|
| Size | 16.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6b33d4be66c1e4b29e72a5b4522af167ccebf678f4938e9019ef437119203677
|
|
BLAKE2b-256 checksum How to use checksums |
b7cb3f2cffda017b5c337985a91dabb65b5142a9dd0b0f6649433dabee6318b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 2, 2026.
Transparency logSecurity for vt2pbf 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for vt2pbf-0.3.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 2, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.