[postgis-users] Fwd: Reg: Get features in a bounding box

Regina Obe lr at pcorp.us
Sun Nov 27 07:35:55 PST 2016


Manikanta,

 

Easiest way is to use the ST_MakeEnvelope function to convert your mins and maxes to a geometry.

 

http://postgis.net/docs/ST_MakeEnvelope.html

 

SELECT t.name, t.geom

FROM  t

WHERE ST_Intersects(t.geom, ST_MakeEnvelope(MIN-X, MIN-Y, MAX-X, MAX-Y,SRID) );

 

Where the upper case I have you replace with your variables and t replace with your table name.

If you want completely enclosed, replace ST_Intersects with ST_CoveredBy

 

 

Hope that helps,

Regina

http://www.postgis.us

http://postgis.net

 

 

 

 

 

From: postgis-users [mailto:postgis-users-bounces at lists.osgeo.org] On Behalf Of Manikanta Kondeti
Sent: Saturday, November 26, 2016 3:16 PM
To: postgis-users at lists.osgeo.org
Subject: [postgis-users] Fwd: Reg: Get features in a bounding box

 

 

Hello,

 

 I have almost empty knowledge on postgis queries and trying to learn them. I beg your pardon if its a very simple question.

 

  So here it is in my current project, as the subject says, I have a list of bounding box cooridnates, MIN-X, MIN-Y, MAX-X MAX-Y with the same SRID of the geom column. Now I want to query the list of features that are enclosed in this bounding box. Awaiting for a reply, thanks in advance.

 

 

Regards,

Manikanta    

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20161127/04483a98/attachment.html>


More information about the postgis-users mailing list