[postgis-users] Query on a subset of a db

Sandro Santilli strk at keybit.net
Mon Mar 5 03:35:32 PST 2012


On Mon, Mar 05, 2012 at 12:29:08PM +0100, Alessandro Candini wrote:
> Hi list.
> 
> I have a db with 50000 geometries inside.
> 
> I would like to search if some features are present ONLY inside a
> given bounding box.
> 
> How can I achieve this?

SELECT * FROM yourdbtable 
 WHERE ST_Contains(
          ST_MakeEnvelope(...),
          geom
       );

--strk;

  ,------o-. 
  |   __/  |    Delivering high quality PostGIS 2.0 !
  |  / 2.0 |    http://strk.keybit.net - http://vizzuality.com
  `-o------'




More information about the postgis-users mailing list