1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Postgis: Dissolve polygons on distance condition

Discussion in 'Programming/Internet' started by MaxPlank, Oct 8, 2018.

  1. MaxPlank

    MaxPlank Guest

    I'm tying to group some polygons in same layer, on geometry & attribute conditions: within 0.8m from each other and with same value in a column. Before you marks this as a duplicate please keep reading :)

    With answers I've found here I've got something like that:

    SELECT ST_Dump(ST_Union(a.geom)).geom as newgeom
    FROM foo a, foo b
    WHERE ST_Intersects(ST_Buffer(a.geom,0.4),ST_Buffer(b.geom,0.4))
    AND a.column = b.column
    AND a.id != b.id
    GROUP BY a.column


    This is the closest I made to the result. However, the difference with all others answers here is that using ST_Dump in order to get singlepart geometries makes my distance condition totally useless, as all geometries will be split even if within 0.8m.

    I'm not much experienced in SQL and may have missed something obvious so any help is welcome, thanks !

    Login To add answer/comment
     

Share This Page