21 votes
Accepted

Converting cluster of Points to Polygons using QGIS

Convex hull - as mentioned by Kazuhito - is one option, but - depending on the cluster shape - you will get more appropriate polygons using concave hulls, for example implemented in ConcaveHull plugin....
user avatar
  • 82.4k
19 votes

Clustering spatial data in R?

Here is a solution based on Find clusters of points based distance rule, but using the distm function from the geosphere package: library(sp) library(rgdal) library(geosphere) # example data from ...
user avatar
  • 311
15 votes

Grouping points in QGIS?

The Concave Hull plugin adds Shared Nearest Neighbor Clustering to processing
user avatar
  • 82.4k
12 votes

Clustering points/polygons based on proximity (within specifed distance) using QGIS?

you can try this (did this in QGIS 2.16) fixed distance buffer each point by 250m (this is half the required distance between points) then dissolve all on the result of that then use multipart to ...
user avatar
  • 19.8k
12 votes

Clustering points in PostGIS

I'd suggest to use the ST_ClusterDBSCAN Window function rather than the Aggregate function ST_ClusterWithin: SELECT *, ST_ClusterDBSCAN(the_geom, eps := <distance>, minpoints := 1) OVER()...
user avatar
  • 24.6k
11 votes
Accepted

Clustering undirected lines

If I understand you right you want to cluster lines that is about the same without respect to direction. Here is an idea that I think could work. split the lines in start point and end point Cluster ...
user avatar
11 votes

Generating urban footprint polygons from building clusters in QGIS?

I was able to get some quite good results, with thanks to Michael Stimson for the suggestion. I had forgotten about the "buffer out, buffer back in" trick (this can also help reduce the number of ...
user avatar
  • 19.8k
10 votes

Spatial clustering with PostGIS?

You can use Kmeans solution more easily with ST_ClusterKMeans method that's available in postgis from 2.3 Example: SELECT kmean, count(*), ST_SetSRID(ST_Extent(geom), 4326) as bbox FROM ( ...
user avatar
  • 373
10 votes

Identify points in a shapefile that have no other point within x km with QGIS

You can use Vector > Analysis Tools > Distance Matrix, and a join to achieve what you ask. I will use qgis sample data airport's layer to exemplify. This is a small dataset so I'm not sure how it ...
user avatar
10 votes
Accepted

How to cluster points into clusters of a maximum diameter in PostGIS?

Previously I'd written a hierarchical clustering algorithm that operated on small groups of points, but it did not scale well to an 8000 point cloud. After some tinkering I got a revamped version to ...
user avatar
  • 3,247
10 votes
Accepted

Birch algorithm does not cluster as expected

I've done some research. I took some points in two coordinate systems non metric (WGS84) and metric (Poland 1992). I used this code: from scipy import loadtxt from sklearn.cluster import Birch ...
user avatar
  • 6,432
10 votes

Converting cluster of Points to Polygons using QGIS

You may be interested in Convex Hull which is in Processing | QGIS geoalgorithms | Vector geometry tools. There is Field option which can be used with Method Create convex hulls based on field. Or ...
user avatar
  • 29.2k
10 votes
Accepted

Points Clustering - QGIS 3.18

You can do the first by creating bins in a new field with the expression ceil(id/30) Where id is your sequential field. This returns 1 for the first 30 points, 2 for points 31-60 and so on. Then, go ...
user avatar
  • 2,799
9 votes
Accepted

Changing size of cluster based on number of markers in Leaflet clustermarker

Starting from the custom example from the github repo, modify the iconCreateFunction to add a different css class based on the size of the cluster: iconCreateFunction: function (cluster) { var ...
user avatar
8 votes
Accepted

QGIS 3.10 - Point cluster symbology sum attribute

Open your symbology menu and click on your cluster symbol: Now click on 'Font Marker' and scroll down to 'Character(s)': Edit the data defined override and insert this expression, if your points ...
user avatar
  • 26.3k
7 votes

Creating polyline-based "heatmap" from GPS tracks?

here is my simple approach: create a new map in umap: http://umap.openstreetmap.fr/en click Import Data a select all the gpx files you have and upload them into map (you can import all of them at ...
user avatar
  • 71
7 votes

Finding mean coordinates of cluster of points from point layer in QGIS

You need to do this in a two-stage process using the Vector > Analysis Tools > Mean Coordinates tool in the second step. This tool will return the mean coordinates for sets of point within a ...
user avatar
  • 33.1k
7 votes

Remove clumps of pixels in R

Thanks to @gene and https://geoscripting-wur.github.io/AdvancedRasterAnalysis/ I can now answer my question (copied and modified): library(raster) # create some raster data r <- raster(ncols=12, ...
user avatar
  • 3,276
7 votes

Clustering of Spatial Data in R or Python

There are an extremely large number of approaches to clustering, and your question is not answerable, short of writing a textbook describing all possible methods. Therefore, the question I will answer ...
user avatar
7 votes
Accepted

Clustering points and summing up attributes per cluster in QGIS

I would try K-means clustering algorithm in the QGIS Processing Toolbox (under Vector analysis group). Just by setting the Number of clusters as 4, it will produce a new Clusters layer with an ...
user avatar
  • 29.2k
7 votes
Accepted

Adding Weight Data to Points in QGIS

If you want to change the size of a point symbol according to an attribute value, click the data driven override icon next to the size setting of the layer's Layer Styling panel and select assistant: ...
user avatar
  • 42.3k
6 votes

XYZ Clustering in Python and numpy arrays

scikit-learn has an extensive clustering library with many different methods available. As a bonus scikit-learn is one of the best documented Python libraries I've seen. When working with 3d point ...
user avatar
  • 15.4k
6 votes

How can I cluster all points in a postgis table together based on their distance from each other?

If you can updgrade to postgis 2.2.0 you might be lucky because that feature has just been introduced. From the doc: "ST_ClusterWithin is an aggregate function that returns an array of ...
user avatar
  • 3,217
6 votes

Clustering undirected lines

Do you really want to cluster solely by direction, without any consideration of origin or destination? If so, there are some very simple ways. Perhaps the easiest is to compute the bearing of each ...
user avatar
  • 67.9k
6 votes

Openlayers 4 Cluster polygons

I found the solution myself, the original features that make up the clustered feature are stored in a property called "features". My zoomed in style becomes: var zoomedInStyle = new ol.style.Style({ ...
user avatar
6 votes
Accepted

Clustering neighboring points inside ArcGIS Desktop?

Result of clustering technique suggested by @Albert shown by colours of points in the picture below. Output will greatly depend on physical order of points in a feature class. At some stage it will ...
user avatar
  • 21.8k
6 votes
Accepted

Using ST_ClusterDBSCAN on results of ST_ClusterKMeans for nested clustering with PostGIS?

Interesting idea. I think you can most easily accomplish this by delaying creation of the MultiPoint geometries until after your data has made it through both clustering algorithms. First, assign a ...
user avatar
  • 12.4k
6 votes

QGIS 3.0 point cluster renderer, is it possible to control rendering order (z-order)?

It seems as though the point cluster implementation does not allow for this natively. Consider the point cluster renderer - it essentially analyzes and clusters point data at render time, creating a ...
user avatar
6 votes

PostGIS: Interpolate/Cluster geographic points to average points

A solution using PostGIS alone. The Steps are as follows: Generate clusters from the points Get the centre of each point cluster Generate a line that connects each cluster centre point (will also ...
user avatar
  • 1,998
5 votes

Creating polyline-based "heatmap" from GPS tracks?

Here is my approach on QGIS. This was for a set of bus routes, and I wanted to identify which roads had the most density of bus routes passing by. Used the Qchainage plugin to convert my lines into ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible