[postgis-users] polygonize line strings

Michael Fuhr mike at fuhr.org
Fri Mar 3 02:55:00 PST 2006


On Fri, Mar 03, 2006 at 09:58:30AM +0100, Bart van den Eijnden (OSGIS) wrote:
> I have a dataset in the form of a linestring shapefile, it is in fact a 
> cadastral map. This shapefile consists of many separate linestrings per 
> polygon, and has an attribute stating the cadastral object to the left 
> of the linestring (PERCEEL_LI), and another one describing the cadastral 
> object right of the linestring (PERCEEL_RE). I also have available a 
> points shapefile which has the cadastrale object code as well.
> 
> Can this data be polygonized with PostGIS? If so how can this be done?

Is the following close to what you're looking for?  If not then
maybe I've misunderstood.

SELECT perceel, polygonize_garray(accum(geom)) AS geom
FROM (
  SELECT perceel_li AS perceel, geom FROM foo
  UNION ALL
  SELECT perceel_re AS perceel, geom FROM foo
) AS s
GROUP BY perceel;

-- 
Michael Fuhr



More information about the postgis-users mailing list