1

PostGIS documentation is horrible. I've read an entry for ST_ClusterDBSCAN multiple times, I've even tried in real world scenario. However I still got the feeling that I misunderstand eps parameter.

For example I've seen people using values as small as 0.1 in there. Doesn't that stand for like 10 santimetres? From the standpoint of my current understanding that doesn't make any sense, does it? How can, for example, 10 sm be a decent distance to cluster villages by? How can there be more than 1 village in such clusters?

Also bigger I make eps slower the query runs and it's another thing that doesn't make sense for me. Why would that be a case?

And the last eps related question is caused by the following quote:

An input geometry will be added to a cluster if it is either:

A "core" geometry, that is within eps distance of at least minpoints input geometries (including itself) or

A "border" geometry, that is within eps distance of a core geometry.

What's core geometry? Or what's border geometry? Since eps is taken into account depending on the type of geometry.

1
  • 2
    Likely eps is distance in the units of the coordinate system.
    – BERA
    Apr 10, 2020 at 12:17

1 Answer 1

4

A quick explanation:

  • The value passed to ST_ClusterDBSCAN as eps is referenced in units of the underlying CRS of the geometry parameter! This can be any planar unit of length (e.g. meter, feet) if the geometry is projected, or degree if it is defined with a geographical reference system. Given these units as example, an eps = 0.1 can be anything between 11km (degrees at the equator) and 1.2in (feet).

  • A core geometry has to have min_points geometries within eps distance; with min_points = 10 and eps = 0.1, a geometry is considered a core geometry if there are 9 or more geometries that are less than 0.1 units away from it (min_points include the given geometry).

  • A border geometry needs to be within eps distance of a core geometry to become part of the same cluster as that core geometry. Since it is possible for a geometry to be a border geometry of multiple, distinct clusters (defined by different core geometries in its vicinity), an assignment is ambiguous and, in PostGIS, will be chosen at random.

  • The larger the eps distance, the more candidates per given geometry have to be checked (distance measured), thus more computational time needs to be spent per geometry, thus more overall execution time.

A thorough explanation:

7
  • Perfect! Thanks.
    – jayarjo
    Apr 10, 2020 at 12:32
  • So basically in the example that I linked the guy was using degrees rather than metres. And that's why he got some meaningful clustering?
    – jayarjo
    Apr 10, 2020 at 12:34
  • Wait wait... or do you mean eps of 0.1 can vary depending on where on the earth it is being measured?? Coordinates in my DB are in UTM. How would I come up with a meaningful value for eps then?
    – jayarjo
    Apr 10, 2020 at 12:37
  • 1
    Kinda, yes. That example definitely doesn't use meter as unit, but degree as unit of measurement is indeed rather meaningless, and would have a significant impact on the clustering results if your geometries span some 30 degrees in latitude; it serves well in terms of spatial relation, but a degree of longitude represents different metric surface lengths at different latitudes. And without the coordinate context, a degree measure is worthless. However, since you are using UTM, the eps unit is meter, so you are save to assume a meaningful value based on metric units.
    – geozelot
    Apr 10, 2020 at 12:46
  • 1
    Technically yes, but keep in mind that the accuracy of the geometric projection of UTM is bound to the UTM Zone!
    – geozelot
    Apr 10, 2020 at 14:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.