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

Stephen Woodbridge woodbri at swoodbridge.com
Fri May 19 06:52:58 PDT 2006


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.



More information about the postgis-users mailing list