[postgis-users] Convert lines to polygon
Michael Fuhr
mike at fuhr.org
Mon Aug 21 06:50:03 PDT 2006
On Mon, Aug 21, 2006 at 02:57:34PM +0200, Vera Schulze wrote:
> this is the query:
> SELECT oid, ogc_fid, astext(polygonize(the_geom)) FROM
> countries_dcw_test WHERE cntry_code = 'QT' GROUP BY oid, ogc_fid
>
> And I attached the data as csv-file.
>
> There are 27 records and originally they are of type line. Some of the
> records contain start and endpoint, the others doesn't.
I think I understand: some of the linestrings form closed figures
like islands, while others are portions of a boundary and aren't
closed. Is that right?
Instead of grouping by oid and ogc_fid, try polygonizing all of the
geometries into a single geometry collection, then use dump() to
extract the individual polygons. This works for me with your dataset:
SELECT astext(geom)
FROM dump((
SELECT polygonize(the_geom)
FROM countries_dcw_test
WHERE cntry_code = 'QT'
));
Will something like that work for you?
--
Michael Fuhr
More information about the postgis-users
mailing list