Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Amyantis/python-vt2geojson
Dump vector tiles to GeoJSON from remote URLs or local system files.
https://github.com/Amyantis/python-vt2geojson
Last synced: 3 months ago
JSON representation
Dump vector tiles to GeoJSON from remote URLs or local system files.
- Host: GitHub
- URL: https://github.com/Amyantis/python-vt2geojson
- Owner: Amyantis
- License: bsd-3-clause
- Created: 2019-03-12T16:54:38.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-20T09:14:26.000Z (almost 2 years ago)
- Last Synced: 2024-07-19T11:57:57.736Z (4 months ago)
- Language: Python
- Size: 26.4 KB
- Stars: 29
- Watchers: 5
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# python-vt2geojson [![Build Status](https://travis-ci.org/Amyantis/python-vt2geojson.svg?branch=master)](https://travis-ci.org/Amyantis/python-vt2geojson)
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:
```python
import geopandas as gpd
import requestsfrom vt2geojson.tools import vt_bytes_to_geojson
MAPBOX_ACCESS_TOKEN = "*****"
x = 150
y = 194
z = 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)
assert r.status_code == 200, r.content
vt_content = r.contentfeatures = 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](https://github.com/Amyantis/python-vt2geojson/issues).