Python library that provides a powerful set of tools and functions for working with quadkeys. Built on top of C it offers lightning-fast calculations, ensuring optimal performance even with large-scale datasets.
Project description
pyquadkey-boosted
Description
pyquadkey-boosted is a high-performance Python library that provides a powerful set of tools and functions for working with quadkeys, enabling seamless integration of tile-based mapping systems into your Python applications. Built on top of a blazing-fast C implementation, pyquadkey-boosted offers lightning-fast calculations, ensuring optimal performance even with large-scale datasets.
Key Features
- Available API's
- Conversion
- lat lng to QuadKey
- QuadKey to lat lng
- QuadKey to BingTile
- BingTile to QuadKey
- Polygon to quadQuadKeykeys
- QuadKey to Multipolygon
- Operations
- get parent
- get childrens
- get K neighbours
- Metadata
- get average tile size
- get zoom level
- get tile distance between two tiles
- WKT, GeoJson, WKB representation of quadkey
- Conversion
- C based backend for fast calculations
- Can handle various types of projections
License
Project Status
- ✅ Add Basic convertion API
- ❎ Implement advance geospatial apis
- ❎ Add support for projections
What is a QuadKey?
A QuadKey is a string representation of a tile's location in a quadtree hierarchy. It is used to index and address tiles at different levels of detail (zoom levels). The QuadKey system is based on dividing the Earth's surface into quadrants using a quadtree structure.
For more details on the concept, please refer to the Microsoft Article About this.
Installation
Requirements
This library requires Python 3.6 or higher. To compile it from source, Cython is required in addition.
using pip
pip install pyquadkey-boosted
From source
Prerequisites (Linux
)
gcc
- Fedora:
dnf install @development-tools
- Ubuntu / Debian:
apt install build-essential
- Fedora:
python3-devel
- Fedora:
dnf install python3-devel
- Ubuntu / Debian:
apt install python3-dev
- Fedora:
Prerequisites (Windows
)
- Visual C++ Build Tools 2015 (with Windows 10 SDK) (see here)
Build from source
# Clone repo
git clone https://github.com/ls-da3m0ns/pyquadkey-boosted
# Create Virtual Environment
python -m venv ./venv
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Compile
python setup.py sdist bdist_wheel
# Install
pip install dist/quadkey-0.0.1-cp38-cp38-linux_x86_64.whl
Usage
Basic Usage
import quadkey
lat = 47.641268
lng = -122.125679
zoom = 15
# Convert lat lng to quadkey
qk = quadkey.geo_to_quadkey(lat, lng, zoom)
# Convert quadkey to lat lng
## get top left corner
lat, lng = quadkey.quadkey_to_geo(qk, corner=0)
## get bottom right corner
lat, lng = quadkey.quadkey_to_geo(qk, corner=2)
# Convert quadkey to bbox
bbox = quadkey.quadkey_to_bbox(qk)
# Convert quadkey to Tile
tl = quadkey.quadkey_to_tile(qk)
# Conver quadkey to quadint
qi = quadkey.quadkey_to_quadint(qk)
# Convert lat lng to quadint
qi = quadkey.geo_to_quadint(lat, lng, zoom)
# get parent quadkey
parent = quadkey.get_parent(qk)
References
I would like to acknowledge the following repositories that served as references during the development of this project:
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
Hashes for quadkey_boosted-1.0.3-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5fb85f9667d88e739d2631b5fb148254463c463ed6420336653435021f8d5537 |
|
MD5 | 3780bcef91e924778b72d39d685ab1ee |
|
BLAKE2b-256 | 8c7f1a5f8c8efe3bf096667a14d2500182be962f94968aa20b4525024e62c227 |