helps handling tile pyramids
Project description
Tilematrix handles geographic web tiles and tile pyramids.
The module is designed to translate between tile indices (zoom, row, column = ZYX) and map coordinates (e.g. latitute, longitude).
Tilematrix supports metatiling and tile buffers. Furthermore it makes heavy use of shapely and it can also generate Affine objects per tile which facilitates working with rasterio for tile based data reading and writing.
It is very similar to mercantile but besides of supporting spherical mercator tile pyramids, it also supports geodetic (WGS84) tile pyramids.
Installation
Use conda to install the latest stable version:
conda install -c conda-forge -y tilematrix
Use pip to install the latest stable version:
pip install tilematrix
Manually install the latest development version
pip install -r requirements.txt
python setup.py install
Documentation
CLI
This package ships with a command line tool tmx which provides the following subcommands:
bounds: Print bounds of given Tile.
bbox: Print bounding box geometry of given Tile.
tile: Print Tile covering given point.
tiles: Print Tiles covering given bounds.
Geometry outputs can either be formatted as WKT or GeoJSON. For example the following command will print a valid GeoJSON representing all tiles for zoom level 1 of the geodetic WMTS grid:
$ tmx -f GeoJSON tiles -- 1 -180 -90 180 90
{
"type": "FeatureCollection",
"features": [
{"geometry": {"coordinates": [[[-90.0, 0.0], [-90.0, 90.0], [-180.0, 90.0], [-180.0, 0.0], [-90.0, 0.0]]], "type": "Polygon"}, "properties": {"col": 0, "row": 0, "zoom": 1}, "type": "Feature"},
{"geometry": {"coordinates": [[[0.0, 0.0], [0.0, 90.0], [-90.0, 90.0], [-90.0, 0.0], [0.0, 0.0]]], "type": "Polygon"}, "properties": {"col": 1, "row": 0, "zoom": 1}, "type": "Feature"},
{"geometry": {"coordinates": [[[90.0, 0.0], [90.0, 90.0], [0.0, 90.0], [0.0, 0.0], [90.0, 0.0]]], "type": "Polygon"}, "properties": {"col": 2, "row": 0, "zoom": 1}, "type": "Feature"},
{"geometry": {"coordinates": [[[180.0, 0.0], [180.0, 90.0], [90.0, 90.0], [90.0, 0.0], [180.0, 0.0]]], "type": "Polygon"}, "properties": {"col": 3, "row": 0, "zoom": 1}, "type": "Feature"},
{"geometry": {"coordinates": [[[-90.0, -90.0], [-90.0, 0.0], [-180.0, 0.0], [-180.0, -90.0], [-90.0, -90.0]]], "type": "Polygon"}, "properties": {"col": 0, "row": 1, "zoom": 1}, "type": "Feature"},
{"geometry": {"coordinates": [[[0.0, -90.0], [0.0, 0.0], [-90.0, 0.0], [-90.0, -90.0], [0.0, -90.0]]], "type": "Polygon"}, "properties": {"col": 1, "row": 1, "zoom": 1}, "type": "Feature"},
{"geometry": {"coordinates": [[[90.0, -90.0], [90.0, 0.0], [0.0, 0.0], [0.0, -90.0], [90.0, -90.0]]], "type": "Polygon"}, "properties": {"col": 2, "row": 1, "zoom": 1}, "type": "Feature"},
{"geometry": {"coordinates": [[[180.0, -90.0], [180.0, 0.0], [90.0, 0.0], [90.0, -90.0], [180.0, -90.0]]], "type": "Polygon"}, "properties": {"col": 3, "row": 1, "zoom": 1}, "type": "Feature"}
]
}
Print WKT representation of tile 4 15 23:
$ tmx bbox 4 15 23
POLYGON ((90 -90, 90 -78.75, 78.75 -78.75, 78.75 -90, 90 -90))
Also, tiles can have buffers around called pixelbuffer:
$ tmx --pixelbuffer 10 bbox 4 15 23
POLYGON ((90.439453125 -90, 90.439453125 -78.310546875, 78.310546875 -78.310546875, 78.310546875 -90, 90.439453125 -90))
Print GeoJSON representation of tile 4 15 23 on a mercator tile pyramid:
$ tmx -output_format GeoJSON -grid mercator bbox 4 15 15
{"type": "Polygon", "coordinates": [[[20037508.342789203, -20037508.3427892], [20037508.342789203, -17532819.799940553], [17532819.799940553, -17532819.799940553], [17532819.799940553, -20037508.3427892], [20037508.342789203, -20037508.3427892]]]}
Conda Publishing
Use bot pull requests generated with every release at tilematrix-feedstock repository for releasing new versions on conda-forge.
License
MIT License
Copyright (c) 2015-2022 EOX IT Services
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file tilematrix-2022.11.dev4.tar.gz
.
File metadata
- Download URL: tilematrix-2022.11.dev4.tar.gz
- Upload date:
- Size: 12.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.23.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a63d1f73abce6d6ea425258a2dfa6ac022a1522a71e544589e2573b04698566e |
|
MD5 | 6a3535a3a811c57421bbd4e0aa70b737 |
|
BLAKE2b-256 | 1c67ab7fcb445997ea40c7255ce2f197a6ceb1cc88798083ac67abe9a5618095 |
File details
Details for the file tilematrix-2022.11.dev4-py2.py3-none-any.whl
.
File metadata
- Download URL: tilematrix-2022.11.dev4-py2.py3-none-any.whl
- Upload date:
- Size: 16.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.23.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01a6c51f4d8ee7467fa4cdef4353cec4597854c136f937b18db2a233bd133233 |
|
MD5 | 3483db8623cfae649a9557ccdc8d7c95 |
|
BLAKE2b-256 | dca85b142285287bad822a32ab7fd737c6c8d3ee33ea4a113b4dcd17ca742563 |