Skip to main content

Python implementation of geographical tiling using QuadKeys as proposed by Microsoft

Project description

🌍 pyquadkey2

Documentation

This is a feature-rich Python implementation of QuadKeys, an approach to geographical tiling, popularized by Microsoft to be used for Bing Maps.

In essence, the concept is to recursively divide the flat, two-dimensional world map into squares. Each square contains four squares as children, which again contain four squares and so on, up centimeter-level precision. Each of these squares is uniquely identifiable with a string like 021030032.

For more details on the concept, please refer to the original article.

muety/pyquadkey2 originates from a fork of buckhx/QuadKey, which is not maintained anymore. It builds on top of that project and adds:

  • ✅ Several (critical) bug fixes
  • ✅ Python 3 support
  • Type hints for all methods
  • ✅ Higher test coverage
  • ✅ Cython backend for improved performance
  • ✅ 64-bit integer representation of QuadKeys
  • ✅ Additional features and convenience methods

Please note: This library is still in development and not considered 100 % stable. You may want to consider mercantile as an alternative (pure Python) implementation of QuadKeys. Also check What the Tile?.

Installation

Requirements

This library requires Python 3.10 or higher. To compile it from source, Cython is required in addition.

Using Pip

$ pip install pyquadkey2

Pip installation is only tested for Linux and Mac, yet. If you encounter problems with the installation on Windows, please report them as a new issue.

From archive

$ wget https://github.com/muety/pyquadkey2/releases/download/0.3.2/pyquadkey2-0.3.2.tar.gz
$ pip install pyquadkey2-0.3.2.tar.gz

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
    • Others: See here

Prerequisites (Windows)

  • Visual C++ Build Tools 2015 (with Windows 10 SDK) (see here)

Build

# Check out repo
$ git clone https://github.com/muety/pyquadkey2

# Create and active virtual environment (optional)
$ python -m venv ./venv
$ source venv/bin/activate

# Install depencencies
$ pip install -r requirements.txt

# Compile
$ cd src/pyquadkey2/quadkey/tilesystem && python setup.py build_ext --inplace && cd ../../../..

# Install as module
$ pip install .

Developer Notes

Unit Tests

python tests/__init__.py

Release

See here.

pip install setuptools wheel auditwheel
python -m build
cd dist
auditwheel repair *.whl
twine upload --repository testpypi wheelhouse/* ../*.tar.gz

License

Apache 2.0

Buy me a coffee

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

pyquadkey2-0.3.2.tar.gz (70.3 kB view details)

Uploaded Source

Built Distribution

pyquadkey2-0.3.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.whl (47.1 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.5+ x86-64

File details

Details for the file pyquadkey2-0.3.2.tar.gz.

File metadata

  • Download URL: pyquadkey2-0.3.2.tar.gz
  • Upload date:
  • Size: 70.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.11

File hashes

Hashes for pyquadkey2-0.3.2.tar.gz
Algorithm Hash digest
SHA256 0c41a4b030169a772bb2b7dab7ebb9b5598e4f9a88378357a1efb69e7ab6f8f6
MD5 03597392833df773d5ffc01f97925816
BLAKE2b-256 3ca245497d197df18186fbb3fa665fcc6ac179d392642ce36d23ad919c77e6ed

See more details on using hashes here.

File details

Details for the file pyquadkey2-0.3.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pyquadkey2-0.3.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 7cf470a0d2b6947fa5fbd5124d964a9916f8eb4b4585eec19b08d42bb16762c2
MD5 1b6b57cfb2b53b32419e2ed8a41f631f
BLAKE2b-256 2b6f4f73e9195e4f5559e26a5a7aae58c5ed9096f7e85cac597eac7f510103f5

See more details on using hashes here.

Supported by

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