[postgis-users] select the interior parcels smaller than 25 hectares

Nicolas Ribot nicolas.ribot at gmail.com
Tue Dec 29 14:42:37 PST 2009


> Hi,
> I  used this SQL for select the interior parcels and obtained all interior
> parcels on the map..
>
> SELECT ST_InteriorRingN((the_geom),s)
> FROM datnivel3, generate_series(1,(SELECT max(ST_NumInteriorRing(the_geom))
> FROM datnivel3)) s
> WHERE ST_NumInteriorRing(the_geom) > 0
> AND ST_InteriorRingN(the_geom,s) IS NOT NULL
>
> .However, I need select from "datnivel3" table, only the parcels  smaller
> than 25 hectares,
> How can I implement this?
>

Hi,

st_area is your friend: add a where clause concerning the area:
... and st_area(the_geom) < 250000
(verifiy your data are stored in metric projection system, or at least
represent meters. And if it is not the case, reproject your data into
a metric coordinate system before applying the area condition
(st_transform to reproject the data)

HTH
Nicolas



More information about the postgis-users mailing list