tiler-swift
Tiler Swift, the swiftest quadkey tiler in the wild west.
Features
- ✔ Get quadkey tiles from raster
- ✔ Simple and blazingly fast
Table of Contents
Overview
This project provides a Python library and a thin command line wrapper on top of it to cut quadkey raster tiles.
Quadkey tiles are raster files of equal size (width, height) on a specific zoom level; the coordinate reference system is the Mercator Projection. The quadkey identifier is constructed by dividing the world into four, then dividing each cell into four again, and so on, recursively.
See
- https://labs.mapbox.com/what-the-tile/
- https://docs.microsoft.com/en-us/bingmaps/articles/bing-maps-tile-system
- https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames
- https://wiki.openstreetmap.org/wiki/Slippy_Map
Library
The quadkeys(dataset, z, nodata=0, tile_filter_fn=None) function provides a generator yielding quadkeys and their associated data.
Args
dataset: the rasterio dataset to cut quadkeys fromz: the zoom level to cut quadkeys atnodata: the value to use for fillingtile_filter_fn: a functionmercantile.Tile -> boolto filter the quadkey generator with
Yields a tuple with
quadkey: the quadkey name e.g.1202121012data: the pixel data as a numpy ndarrayprofile: the rasterio profile with metadata e.g. transformation for geo-referencing
Example usage:
for quadkey, data, profile in quadkeys(dataset, z=args.zoom):
print(quadkey)
with rasterio.open(args.out, "w", **profile) as out:
out.write(data)
Command Line
usage: tiler-swift [-h] -z ZOOM -o OUT [-n NODATA] raster
cuts quadkeys from raster
positional arguments:
raster raster to cut quadkeys from
optional arguments:
-h, --help show this help message and exit
-z ZOOM, --zoom ZOOM zoom level to cut quadkeys at (default: None)
-o OUT, --out OUT directory to write quadkeys to (default: None)
-n NODATA, --nodata NODATA
nodata value to use for filling at edges (default: None)
Example usage:
quadkeys input.tif -o output.tif -z 10 -n 0
Development
For development
make
make run
$ tiler-swift --help
Inside the self-contained reproducible container
flake8 rfq
mypy rfq
pytest
License
Copyright © 2020 robofarm
Distributed under the MIT License (MIT).
Release files for tiler-swift 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tiler-swift-1.1.0.tar.gz | 1.2 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tiler_swift-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 2.4 MB
Release files / tiler-swift-1.1.0.tar.gz
| Download URL | tiler-swift-1.1.0.tar.gz |
|---|---|
| Size | 1.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0dc500bf2a8d91c83d90d4d67646dcd77f731f28e225db9bd055faae6dce5997
|
|
BLAKE2b-256 checksum How to use checksums |
aaa378ad5400bbb249c29c764600d29c5fd3ab44ffd8d179a9df21e3c5daa3ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.6 CPython/3.8.5 Linux/5.8.0-55-generic
|
Release files / tiler_swift-1.1.0-py3-none-any.whl
| Download URL | tiler_swift-1.1.0-py3-none-any.whl |
|---|---|
| Size | 1.2 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
20b951b9f3d894d2a3324b50b6de1cc0eed8e59c62873bbcf1859c963c54121c
|
|
BLAKE2b-256 checksum How to use checksums |
ea5c4c82f76934aaed90abc60d1ad226068d126d9907bbf50ca5f33b5e5be57a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.6 CPython/3.8.5 Linux/5.8.0-55-generic
|