Dump vector tiles to GeoJSON from remote URLs or local system files.
Inspired from https://github.com/mapbox/vt2geojson.
pip install vt2geojson
Using the CLI:
vt2geojson --help
Making a GeoDataframe from a PBF vector tile file:
importgeopandasasgpdimportrequestsfromvt2geojson.toolsimportvt_bytes_to_geojsonMAPBOX_ACCESS_TOKEN="*****"x=150y=194z=9url=f"https://api.mapbox.com/v4/mapbox.mapbox-streets-v6/{z}/{x}/{y}.vector.pbf?access_token={MAPBOX_ACCESS_TOKEN}"r=requests.get(url)
assertr.status_code==200, r.contentvt_content=r.contentfeatures=vt_bytes_to_geojson(vt_content, x, y, z)
gdf=gpd.GeoDataFrame.from_features(features)- Add more test using
vector-tile/test/fixtures/*.vector.pbfdata files.
This library has only been tested against Python 3.6.
Feel free to submit your issues.