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.13 or higher. To compile it from source, Cython is required in addition.

Using pip / uv

$ uv add pyquadkey2  # pip install pyquadkey2

Pip / uv 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.4/pyquadkey2-0.3.4.tar.gz
$ pip install pyquadkey2-0.3.4.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

# Init venv and install dependencies
$ uv sync

# Build distribution package
$ uv build

Developer Notes

Unit Tests

# Use env PYTHONPATH=./src as a option to choose test on src or test on installed package
PYTHONPATH=./src python3 -m unittest -v tests/test_*.py tests/*/test_*.py

Release

See here.

cd dist
uv tool twine upload --repository testpypi *

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.4.tar.gz (12.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyquadkey2-0.3.4-cp314-cp314-win_amd64.whl (41.0 kB view details)

Uploaded CPython 3.14Windows x86-64

pyquadkey2-0.3.4-cp314-cp314-musllinux_1_2_x86_64.whl (173.5 kB view details)

Uploaded CPython 3.14musllinux: musl 1.2+ x86-64

pyquadkey2-0.3.4-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (175.9 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

pyquadkey2-0.3.4-cp314-cp314-macosx_11_0_arm64.whl (43.9 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

pyquadkey2-0.3.4-cp313-cp313-win_amd64.whl (40.3 kB view details)

Uploaded CPython 3.13Windows x86-64

pyquadkey2-0.3.4-cp313-cp313-musllinux_1_2_x86_64.whl (174.4 kB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

pyquadkey2-0.3.4-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (176.9 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

pyquadkey2-0.3.4-cp313-cp313-macosx_11_0_arm64.whl (43.9 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: pyquadkey2-0.3.4.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for pyquadkey2-0.3.4.tar.gz
Algorithm Hash digest
SHA256 708915514e2d18d7c55b39db83d8ee0f16721e78d7547b46b056e54eff94fb71
MD5 eedd2d2ae9ec297c30ed97ad31e29e07
BLAKE2b-256 f29bb883339dab12d4125f4a0163af24045a7cb262f12de52dae89ac25bafd79

See more details on using hashes here.

File details

Details for the file pyquadkey2-0.3.4-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: pyquadkey2-0.3.4-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 41.0 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for pyquadkey2-0.3.4-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 9553d86325caeb24dcd75242af3df062e2b4deb95fe4abb1fc9914c6a88117a7
MD5 074b1f67fe7bd5474dbb6a810f3e2468
BLAKE2b-256 1de525055f1c7db4f75bc7a5ffd8b91fbb40d9aee413a875785836d86bb1dff3

See more details on using hashes here.

File details

Details for the file pyquadkey2-0.3.4-cp314-cp314-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pyquadkey2-0.3.4-cp314-cp314-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 51961eceb5acc3f9dc15677d2a12047de01e078e037bc8681149760d22e52df8
MD5 e4b92f722a60019daf0f81e6664ab734
BLAKE2b-256 3768a8d9e287f0c8afee2b301c84f124c6f083f15c5a2dc4cc742edc9b09c6fb

See more details on using hashes here.

File details

Details for the file pyquadkey2-0.3.4-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for pyquadkey2-0.3.4-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 cabd08559a870824749589a9ad68ef3cf759b6df28050a81fc8b514d634fc4f6
MD5 3f81ccb175fde8c74cc957d1bf2ce13f
BLAKE2b-256 aa1c1dc2bb5f9a039405a47a09a3d4a237e82c805af7aaf358a4fa7b86152351

See more details on using hashes here.

File details

Details for the file pyquadkey2-0.3.4-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyquadkey2-0.3.4-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 809dab06037b4f6ff6dd229b43d9dfb69f78cbfa1a836a7a9044b9a8fc5fa1be
MD5 c4fae31ab25dfa05a84a802131b1ec82
BLAKE2b-256 520cc2c6b44d3e43c02881709039a5055020c56cd042c716cf98b6538b2d6aba

See more details on using hashes here.

File details

Details for the file pyquadkey2-0.3.4-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pyquadkey2-0.3.4-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 40.3 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for pyquadkey2-0.3.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 c54949944d124bfa1fc15a52e527a1161ee4049df46fe8c4dc08c150fe881baf
MD5 d392665f4e082cfbfa96dff8b8c35d93
BLAKE2b-256 0c8613b76ca19f6a93a706c3310c01eb06bdc0bc87192d1bd2f8b3daae222988

See more details on using hashes here.

File details

Details for the file pyquadkey2-0.3.4-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pyquadkey2-0.3.4-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 705935eaa6c2ff27ceca9f4d14458846c55d242134417e09cdd659cea04beb9f
MD5 8eb48cf32ccdd919cf609b618b4f437a
BLAKE2b-256 85432177faad7951ffd1375d1437fe89fccc61e543fc81f33eb63016e77c078b

See more details on using hashes here.

File details

Details for the file pyquadkey2-0.3.4-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for pyquadkey2-0.3.4-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 d0344d56c909bfa7d21caf8a9ec590e68b8b51a61da7f249ff321d0de83f4182
MD5 109b2250ed8832f5b89ab52c7a084378
BLAKE2b-256 656bcd1c8b61c5ffde274d53cc376c18e24207135bfd195062d56022613e5bb0

See more details on using hashes here.

File details

Details for the file pyquadkey2-0.3.4-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyquadkey2-0.3.4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7a179787e69de5f8c00c79c27c9d12745b5385708f719dcffb97b071fcb9d877
MD5 94e7970d4c9198004f6dafaeb5b52280
BLAKE2b-256 b4ad8e1018f9346a1f6a2f5fe87b7b2ccf4b89b49596bae99cfdbdc32114df7d

See more details on using hashes here.

Supported by

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