Skip to main content

Dump vector tiles to GeoJSON from remote URLs or local system files.

Project description

python-vt2geojson Build Status

Dump vector tiles to GeoJSON from remote URLs or local system files.

Inspired from https://github.com/mapbox/vt2geojson.

Installation

pip install vt2geojson

Usage

Using the CLI:

vt2geojson --help

Making a GeoDataframe from a PBF vector tile file:

import geopandas as gpd
import requests

from vt2geojson.tools import vt_bytes_to_geojson

MAPBOX_ACCESS_TOKEN = "*****"

x = 150
y = 194
z = 9

url = f"https://api.mapbox.com/v4/mapbox.mapbox-streets-v6/{z}/{x}/{y}.vector.pbf?access_token={MAPBOX_ACCESS_TOKEN}"
r = requests.get(url)
assert r.status_code == 200, r.content
vt_content = r.content

features = vt_bytes_to_geojson(vt_content, x, y, z)
gdf = gpd.GeoDataFrame.from_features(features)

Todos:

  • Add more test using vector-tile/test/fixtures/*.vector.pbf data files.

Notes

This library has only been tested against Python 3.6.

Feel free to submit your issues.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vt2geojson-0.2.1.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

vt2geojson-0.2.1-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file vt2geojson-0.2.1.tar.gz.

File metadata

  • Download URL: vt2geojson-0.2.1.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/57.0.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.6.9

File hashes

Hashes for vt2geojson-0.2.1.tar.gz
Algorithm Hash digest
SHA256 bba39788ed8f019e8d30cedc9cefe8f4c8cb51c5e4906349fe1929d48a5092e2
MD5 9ca290c0619ce4d637532e04463c2a16
BLAKE2b-256 5f6656b8f7eab94b62e7ce1622a0788a81ee0282e022716b0c26f482a4f242f5

See more details on using hashes here.

File details

Details for the file vt2geojson-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: vt2geojson-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/57.0.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.6.9

File hashes

Hashes for vt2geojson-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7da0b1f9f7020769c50bf8371a4f7db84297adb7ec1ef7dc7afc9d322cac6def
MD5 4904398488a8dfc029f3f60f287304ee
BLAKE2b-256 ca59ecc3e402c102abadb7fbc742d126afedbf3bb36038cf92b4ac5472479e7f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page