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 python-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}/{z}.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)

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.1.4.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

vt2geojson-0.1.4-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: vt2geojson-0.1.4.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.2

File hashes

Hashes for vt2geojson-0.1.4.tar.gz
Algorithm Hash digest
SHA256 3608d5f696a7124de21fa32354902a3fada39fddf945e18e1d729c36592a39bf
MD5 056ce076ed6f3d81aceecd65fa6ea61b
BLAKE2b-256 bbe612f2ef718cc94af6ab3b3699b124e5544670c21b36e06e3b8526ebf11fbf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vt2geojson-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.2

File hashes

Hashes for vt2geojson-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2e7e9e1a29d145ffdfc8494528f9a02ca02ec53cc87015ba71f0d7f206789bae
MD5 6b9b542d1931cee7627756530181a708
BLAKE2b-256 5e868419f77d8dd15642f2e139d5b39be0aa931f06fa5ca8fc8f2496d2f95c90

See more details on using hashes here.

Supported by

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