Socket
Socket
Sign inDemoInstall

tiler-swift

Package Overview
Dependencies
3
Maintainers
1
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    tiler-swift

Tiler Swift, the swiftest quadkey tiler in the wild west


Maintainers
1

Readme

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

  1. Overview
  2. Library
  3. Command Line
  4. Development
  5. License

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

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 from
  • z: the zoom level to cut quadkeys at
  • nodata: the value to use for filling
  • tile_filter_fn: a function mercantile.Tile -> bool to filter the quadkey generator with

Yields a tuple with

  • quadkey: the quadkey name e.g. 1202121012
  • data: the pixel data as a numpy ndarray
  • profile: 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).

FAQs


Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc