A fast geospatial point clustering module.
Project description
A fast Python 3 module for geospatial point clustering.
This is a port of https://github.com/mapbox/supercluster to C++, conveniently wrapped in a Python module. Initial benchmarks show it to be an order of magnitude (10x) faster than the original JavaScript implementation.
Installing pysupercluster
The easiest way to install pysupercluster is to use pip:
pip install pysupercluster
Using pysupercluster
>>> import numpy
>>> import pysupercluster
>>> points = numpy.array([
... (2.3522, 48.8566), # paris
... (-0.1278, 51.5074), # london
... (-0.0077, 51.4826), # greenwhich
... ])
>>> index = pysupercluster.SuperCluster(
... points,
... min_zoom=0,
... max_zoom=16,
... radius=40,
... extent=512)
>>> clusters = index.getClusters(
... top_left=(-180, 90),
... bottom_right=(180, -90),
... zoom=4)
[
{'id': 0, 'count': 1, 'expansion_zoom': None, 'latitude': 48.8566, 'longitude': 2.3522},
{'id': 3, 'count': 2, 'expansion_zoom': 8, 'latitude': 51.49500168658321, 'longitude': -0.06774999999998421}
]
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
pysupercluster-0.7.7.tar.gz
(8.2 kB
view details)
File details
Details for the file pysupercluster-0.7.7.tar.gz
.
File metadata
- Download URL: pysupercluster-0.7.7.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90011bb1b8cb14aa3d59b484710d539d088fdfdb9a2173859f086c46f5b61a60 |
|
MD5 | 9b4d9a4ac698ee7cd24663e98450d3f2 |
|
BLAKE2b-256 | 993090cb20b67c0202b3739f7c87d6d8e00ad04b76db5a82012ffadf7593c99c |