[postgis-users] How can I convert a geometry column to polygons

Stephen Woodbridge woodbri at swoodbridge.com
Fri May 19 07:03:12 PDT 2006


Oh, if you really want the intersection of the polygons, then you will 
need to deal with results that are not always a polygon, because the 
intersection of two polygons does not have to be a polygon, it can in 
fact be a point if the two polygons touch at a vertex or a linestring if 
the share a common edge(s).

I this case you probably need to write a set returning function the 
allows you to scan the results and return just the polygons.

I would probably be a nice function to add to PostGIS. Something like

<set_of_geom_type> = extract_geom(<collection>, <geom_type>);

or something similar.

-Steve

Stephen Woodbridge wrote:
> Brent Wood wrote:
> 
>>
>> I have a table with a polygon geometry table. I want to select a 
>> subset of the
>> polygons via an area, which is defined by another polygon.
>>
>> I can sort of get the result using intersection() but the result is a 
>> set of
>> geometries, not polygons.
>> How can I turn these into polygons?
> 
> 
> What do you want to get back from the polygon table is an polygon there 
> partially intersects your selection polygon?
> 
> If you want all of the partials, then
> 
> select * from polygon_table
> where
>   the_geom && select_polygon and
>   intersects(the_geom, select_polygon);
> 
> 
> you can replace "select_polygon" with a sub-select like Eric suggested. 
> If you only want the polygons that are totally within the select polygon 
> then change the intersects() to within()
> 
> -Steve W.
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 




More information about the postgis-users mailing list