Skip to main content

A fast geospatial point clustering module.

Project description

travis

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

Uploaded Source

File details

Details for the file pysupercluster-0.7.6.tar.gz.

File metadata

  • Download URL: pysupercluster-0.7.6.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

File hashes

Hashes for pysupercluster-0.7.6.tar.gz
Algorithm Hash digest
SHA256 1e9739e9dad6126f346b5816dd6d9affc31d8482ef89fd30ff87f8412530726a
MD5 e064e28117402d2c40273048108b3552
BLAKE2b-256 c60a18299216f9d753dbcdb74f220dbdd0ea2ef492714559ca00df24dd647b9e

See more details on using hashes here.

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