[postgis-users] Convert lines to polygon

Vera Schulze v.schulze at ccgis.de
Mon Aug 21 07:09:36 PDT 2006


Michael Fuhr schrieb:
> 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?
> 

Thats it! Perfect, thanks a lot for your help!!

-- 

Mit freundlichen Grüßen

Vera Schulze

----------------------------------

  Vera Schulze
  CCGIS GbR
  Siemensstraße 8
  53121 Bonn
  Germany

----------------------------------
   v.schulze at ccgis.de
         www.ccgis.de
----------------------------------
  Tel.:      ++49 (0) 228 90826 28
  Fax.:      ++49 (0) 228 90826 11
  Zentrale:  ++49 (0) 228 90826 0
----------------------------------



More information about the postgis-users mailing list