Skip to main content

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

quadkey-boosted

License Python C

Description

quadkey-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, quadkey-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
  • C based backend for fast calculations
  • Can handle various types of projections

License

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 quadkey-boosted

From source

Prerequisites (Linux)

  • gcc
    • Fedora: dnf install @development-tools
    • Ubuntu / Debian: apt install build-essential
  • python3-devel
    • Fedora: dnf install python3-devel
    • Ubuntu / Debian: apt install python3-dev

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/quadkey-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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quadkey-boosted-1.0.4.tar.gz (59.4 kB view hashes)

Uploaded Source

Built Distribution

quadkey_boosted-1.0.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl (214.1 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.5+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page