[postgis-users] Expanding a polygon

Kevin Neufeld kneufeld at refractions.net
Mon Jan 11 12:41:39 PST 2010


If your dataset is not too large, you could try to ST_Union() your polygons together and then expand the MULTI* polygons 
back to individual features.

SELECT
   ST_AsText((ST_Dump(ST_Union(column1))).geom)
FROM (VALUES
   ('POLYGON (( 2 4, 2 5, 3 5, 3 4, 2 4 ))'::geometry),
   ('POLYGON (( 3 3, 3 4, 4 4, 4 3, 3 3 ))'::geometry),
   ('POLYGON (( 1 1, 1 2, 2 2, 2 1, 1 1 ))'::geometry),
   ('POLYGON (( 3 4, 3 5, 4 5, 4 4, 3 4 ))'::geometry),
   ('POLYGON (( 2 1, 2 2, 3 2, 3 1, 2 1 ))'::geometry)
   ) a;
                    st_astext
------------------------------------------------
  POLYGON((1 1,1 2,2 2,3 2,3 1,2 1,1 1))
  POLYGON((3 3,3 4,2 4,2 5,3 5,4 5,4 4,4 3,3 3))
(2 rows)

-- Kevin


Yurka wrote:
> Maybe i should explain what i'm trying to accomplish. 
> 
> I have bunch of polygons that would share one side, i want to combine them
> into one. 
> 



More information about the postgis-users mailing list