[postgis-users] Merge function in PostGIS

Michael Fuhr mike at fuhr.org
Mon Oct 30 17:34:48 PST 2006


On Mon, Oct 30, 2006 at 01:50:26PM -0700, Bruce Rindahl wrote:
> I need a merge function in PostGIS.  What this means is if I have a
> multipolygon and if any two parts share a common edge I need the union of
> the two parts in one polygon.  For example if I have:
> MULTIPOLYGON(((partA)),((partB)),((partC))) where partA and partC intersect
> or share a common edge, the result will be:
> MULTIPOLYGON(((Union of partA & partC)),((partB)))

Something like this might work:

SELECT GeomUnion(geom)
FROM (SELECT (dump(the_geom)).geom
      FROM tablename
      WHERE ...) AS s;

-- 
Michael Fuhr



More information about the postgis-users mailing list