I'm using the Mapbox Vector Tile API and I want to get the data into one or multiple GeoPandas GeoDataFrame. (Python)
After I download the .mvt file, how do I decode it?
What I've tried already:
- mapbox-vector-tile library, this decodes the file into a dictionary (JSON) but does not transform the given coordinates.
- python-vt2geojson library, this transforms the coordinates but the information about the layers is lost.
ogr2ogr
withogr2ogr -f GeoJSON $file_path_json $file_path_mvt -oo x=$x -oo y=$y -oo z=$z
but this yields the error
ERROR 1: Layer 'aeroway' does not already exist in the output dataset, and cannot be created by the output driver.
ERROR 1: Terminating translation prematurely after failed
translation of layer aeroway (use -skipfailures to skip errors)
ogr2ogr
withogr2ogr -f "ESRI Shapefile" $file_path_shp $file_path_mvt -oo x=$x -oo y=$y -oo z=$z
but this yields the error
Warning 6: Normalized/laundered field name: 'admin_level' to 'admin_leve'
Warning 6: Normalized/laundered field name: 'name_script' to 'name_scrip'
Warning 6: Normalized/laundered field name: 'text_anchor' to 'text_ancho'
Warning 6: Normalized/laundered field name: 'name_zh-Hans' to 'name_zh-Ha'
Warning 6: Normalized/laundered field name: 'name_script' to 'name_scrip'
Warning 6: Normalized/laundered field name: 'name_zh-Hant' to 'name_zh-_1'
Warning 1: One or several characters couldn't be converted correctly from UTF-8 to ISO-8859-1. This warning will not be emitted anymore.
Warning 6: Normalized/laundered field name: 'name_script' to 'name_scrip'
Warning 6: Normalized/laundered field name: 'shield_text_color' to 'shield_tex'
ERROR 1: Attempt to write non-linestring (GEOMETRYCOLLECTION) geometry to ARC type shapefile.
ERROR 1: Unable to write feature 91 from layer road.
ERROR 1: Terminating translation prematurely after failed
translation of layer road (use -skipfailures to skip errors)
Has anyone a clue of how to decode Mapbox Vector Tile files into files that can be read into GeoPandas with the coordinates transformed to longitude and latitude?