Usage
geojson2vt
# build an initial index of tiles
tile_index = geojson2vt(geojson, {})
# request a particular tile
features = tile_index.get_tile(z, x, y).get('features')
# show an array of tile coordinates created so far
print(tile_index.tile_coords) # [{'z': 0, 'x': 0, 'y': 0}, ...]
You can fine-tune the results with an options object, although the defaults are sensible and work well for most use cases.
By default, tiles at zoom levels above indexMaxZoom are generated on the fly, but you can pre-generate all possible tiles for data by setting indexMaxZoom and maxZoom to the same value, setting indexMaxPoints to 0, and then accessing the resulting tile coordinates from the tile_coords property of tile_index.
The promoteId and generateId options ignore existing id values on the feature objects.
geojson2vt only operates on zoom levels up to 24.
tile_index = geojson2vt(data, {
'maxZoom': 14, # max zoom to preserve detail on; can't be higher than 24
'tolerance': 3, # simplification tolerance (higher means simpler)
'extent': 4096, # tile extent (both width and height)
'buffer': 64, # tile buffer on each side
'lineMetrics': False, # whether to enable line metrics tracking for LineString/MultiLineString features
'promoteId': None, # name of a feature property to promote to feature.id. Cannot be used with `generateId`
'generateId': False, # whether to generate feature ids. Cannot be used with `promoteId`
'indexMaxZoom': 5, # max zoom in the initial tile index
'indexMaxPoints': 100000 # max number of points per tile in the index
}, logging.INFO)
vt2geojson
# build an initial index of tiles
tile_index = geojson2vt(geojson_data, {})
# get a specific tile
vt_tile = tile_index.get_tile(z, x, y)
# convert a specific vector tile to GeoJSON
geojson = vt2geojson(vt_tile)
Acknowledgements
All the credit belongs to the collaborators of JS GeoJSON-VT.
Metadata
Release files for geojson2vt 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| geojson2vt-1.0.1.tar.gz | 10.0 kB | Without provenance | Details for geojson2vt-1.0.1.tar.gz |
Release files / geojson2vt-1.0.1.tar.gz
| Download URL | geojson2vt-1.0.1.tar.gz |
|---|---|
| Size | 10.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d03311dfa28e681d702e604595f8894a42bb48a717db7763d4fdbe11aff1f507
|
|
BLAKE2b-256 checksum How to use checksums |
b88786455da7e587c10cfd9e264f69d62e3ca2c82fbc7304d18289a174a063b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.7
|
Security for geojson2vt 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.