Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wemap/pysupercluster
A fast geospatial point clustering module
https://github.com/wemap/pysupercluster
Last synced: 18 days ago
JSON representation
A fast geospatial point clustering module
- Host: GitHub
- URL: https://github.com/wemap/pysupercluster
- Owner: wemap
- License: isc
- Created: 2016-10-02T16:07:02.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2023-12-11T18:40:29.000Z (11 months ago)
- Last Synced: 2024-10-13T23:36:59.235Z (about 1 month ago)
- Language: C++
- Homepage:
- Size: 36.1 KB
- Stars: 36
- Watchers: 8
- Forks: 11
- Open Issues: 6
-
Metadata Files:
- Readme: README.rst
- License: LICENSE.txt
Awesome Lists containing this project
README
pysupercluster
==============|tests|
.. |tests| image:: https://github.com/wemap/pysupercluster/workflows/tests/badge.svg
:target: https://github.com/wemap/pysupercluster/actionsA 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
--------------------.. code-block:: pycon
>>> 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}
]