Package: geoclustering
geoclustering📍 command-line tool for clustering geolocations.FeaturesUsesDBSCANorOPTICSto perform clustering.Outputs clustering results asjson,txtandgeojson.Creates akepler.glvisualization of clusters.Clustering MethodA cluster is created when a certain number of points (defined with--size) each are within a given distance (defined with--distance) of at least one other point in the cluster.InstallInstall with pip:# with kepler.gl visualization supportpipinstallgeoclustering[full]# only text-based outputpipinstallgeoclusteringIf thefullinstall fails, you might need to install kepler.gl build dependencies:# macosbrewinstallprojgdalUsageUsage: geoclustering [OPTIONS] FILENAME

  Tool to cluster geolocations. A cluster is created when a certain number of
  points (defined with --size) each are within a given distance (defined with
  --distance) of at least one other point in the cluster. Input is supplied as
  a csv file. At a minimum, each row needs to have a 'lat' and a 'lon' column.
  Other rows are reflected to the output.

Options:
  -d, --distance FLOAT            (in km) Max. distance between two points in
                                  a cluster.  [required]
  -s, --size INTEGER              Min. number of points in a cluster.
                                  [required]
  -o, --output PATH               Output directory for results. Default:
                                  ./output
  -a, --algorithm [dbscan|optics]
                                  Clustering algorithm to be used. `optics`
                                  produces tighter clusters but is slower.
                                  Default: dbscan
  --open                          Open the generated visualization in the
                                  default browser automatically.
  --debug                         Print debug output.
  --help                          Show this message and exit.InputInputs are supplied as a.csvfile. At a minimum, each row needs to have alatand a `lon`` column. Other rows are reflected to the output.id,name,lat,lon
1,Bonnibelle Mathwen,40.1324085,64.4911086
...OutputIf at least one cluster was found, the tool outputs a folder with output asjson,geojson,txt,csvfiles. A kepler.glhtmlfile is generated as well.JSONEncodes an array of clusters, each containing an array of points.[{"cluster_id":0,"points":[{"id":9,"name":"Rosanna Foggo","lat":-6.2074293,"lon":106.8915948}]}]GeoJSONEncodes a singleFeatureCollection, containing all points asFeatureobjects.{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[106.891595,-6.207429]},"properties":{"id":9,"name":"Rosanna Foggo","cluster_id":0}}]}TextEncodes cluster as blocks separated by a newline, where each line in a cluster block contains one point.Cluster 0
id 9, name Rosanna Foggo, lat -6.2074293, lon 106.8915948

// ...CSVEncodes each event in one line withcluster_idinformation associated.cluster_id,name,lat,lon
9,Rosanna Foggo,-6.2074293,106.8915948
...kepler.glDevelopIt is assumed that you are usingPython3.9+. It is encouraged tosetup a virtualenvfor development.# install dependencies & dev-dependencies# PIPpipinstall-e.[dev,full]# PIPENVpipenvinstall--dev-e.# install a git hook that runs the code formatter before each commit.pre-commitinstallWe useBlackas our code formatter. If you don't want to use thepre-commithook, you can run the formatter manually or via an editor plugin.ReleaseUpdateversion.pyRunscripts/release.shConfirm GH action completed successfully