Skip to main content
Question

Clustering points into groups by proximity and attributes.

  • September 25, 2020
  • 1 reply
  • 303 views

gisupanalizy

Hello everyone!

 

I'm trying to get to know if it's possible to cluster (combine with the same e.g. cluster_id field) points that are lying within some distance to each other and additionally have the same, selected attributes.

For example I have PostGIS data containing buildings as points. Some of them have the same elevation and are very close to each other, due to the fact that someone entered them like this. 

I need to make my data smaller by grouping them, but only if they are close to each other AND have the same elevation (to be sure that I've grouped points standing for the same building.

Here's example which I've been able to achieve for now using PostGIS only:

select geom, point_id, height_ft, elevation_ft, obstacle_type, clst_id
into output_table_name
from
(
SELECT geom, point_id, height_ft, elevation_ft, obstacle_type,
       ST_ClusterDBSCAN(geom, eps := 0.0003, minpoints := 1) OVER() AS clst_id
FROM   (select geom, point_id, height_ft, elevation_ft, obstacle_type from input_table where country_code = 'ARE') y
) x

2020-09-25 17_20_44-Untitled - ArcMap

As you can see its only taking into account the proximity. Coordinate system is WGS84 so I've put as proximity distance parameter 0.0003, which should be less than 50 meters in ground units.

I'd like to distinguish those groups also by common elevation.

 

I'd be grateful for any directions.

1 reply

chrisatsafe
Contributor
Forum|alt.badge.img+2
  • Contributor
  • September 28, 2020

Hi @gisupanalizy​ ,

If you have the elevation extracted as a parameter perhaps you could achieve this using the Group By Function in the NeighborFinder. This will allow you to group by elevation, or other/additional attribute(s), specify the number of neighbors to find, and the max distance of each neighbor.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings