[postgis-users] Building polygons from several line segments.

Bruce Saunders brucesaunders at maximus.com
Fri Nov 14 06:12:37 PST 2003


I have a table of line segments (a la Tiger/Line data), that I would 
like to build into the polygon objects that they represent.  I know how 
to identify a group of rows that represent a single polygon.  I'm having 
trouble finding a way, with the built in PostGIS/GEOS functions to 
simplify my results to a POLYGON.  I can get the GeomUnion, or collect 
my results, but that just results in a more complex MULTILINESTRING.  
I've tried taking the boundary of the GeomUnion or collect results, but 
that just returns "SRID=-1;MULTIPOINT(EMPTY)".  I'm on the edge of 
coding this up myself, but I'm hoping that maybe I've missed something 
and there's an easier solution to my problem.  If not, I'd like some 
suggestions about where in the code this would best fit (external to 
PostGIS, part of PostGIS or part of GEOS).  Of course I'd share my code 
if I extend either GEOS or PostGIS (assuming that anyone else would find 
this useful).  Anyhow, I'd greatly appreciate any thoughts or ideas.

Thanks a bunch.

-Bruce Saunders




More information about the postgis-users mailing list