New answers tagged

1

The eps distance is the maximum distance between points in the cluster, not the maximum width of the entire cluster. So if you have points A, B, and C, as long as each point is within the eps distance of one other point, then it gets included in the cluster. If the eps distance was 1 km, A could be within 1 km of B, and C can be within 1 km of B, but A can ...


2

I resolve with this script: library(sp) library(rgdal) library(geosphere) # example data from the thread x <- c(-1.482156, -1.482318, -1.482129, -1.482880, -1.485735, -1.485770, -1.485913, -1.484275, -1.485866) y <- c(54.90083, 54.90078, 54.90077, 54.90011, 54.89936, 54.89935, 54.89935, 54.89879, 54.89902) # convert data to a SpatialPointsDataFrame ...


1

No time for more improving or testing, but: for a single, more generic recursive term, and possibly better performance, try WITH RECURSIVE params AS ( -- convenience variables for testing parameters SELECT 10 AS max_size, -- max. cluster size 1 AS max_points, -- 'max_points' parameter ...


1

I have been able to work around the limitation by "pre-computing" the values for eps and inferring reasonable values of the other subqueries which where previously referring to the recursive CTE. Note that the new solution may create clusters larger than wanted (5000 in the query below) if you run-out of "pre-computed" values. This helps ensure that the ...


1

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 ( SELECT ST_ClusterKMeans(geom, 20) OVER() AS kmean, ST_Centroid(geom) as geom FROM sls_product ) tsub GROUP BY kmean; The bounding box of features is used as ...


1

Let's work through a Haussdorf clustering of lines. We'll use the sf package for spatial data and distance calculations: library(sf) starting with your final x, lets group everything by cyclone number, make line features, and keep the number of points in the group: cyclones = x %>% group_by(CycloneNo) %>% mutate(n=n()) %>% summarize(n=mean(n),...


Top 50 recent answers are included