Fwd: Reg: Get features in a bounding box

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Fwd: Reg: Get features in a bounding box

Manikanta Kondeti

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    


_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Reg: Get features in a bounding box

Andy Colson
On 11/26/2016 02:16 PM, Manikanta Kondeti wrote:

>
> 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
>

Have you read the documentation?

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

Start with && operator, and the st_within function.

-Andy
_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Reg: Get features in a bounding box

Regina Obe
In reply to this post by Manikanta Kondeti

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:[hidden email]] On Behalf Of Manikanta Kondeti
Sent: Saturday, November 26, 2016 3:16 PM
To: [hidden email]
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    

 


_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Reg: Get features in a bounding box

Manikanta Kondeti
Andy & Regina, 

Thanks for the help.  I've tried in two ways as given below, I thought the first one is the query needed, but the results are a little different, while second one gave accurate results.  

1. plots.geom &&  ST_MakeEnvelope(80.478328, 16.504874, 80.478922, 16.505413, 4326)
2. ST_Intersects(ST_MakeEnvelope(80.478328, 16.504874, 80.478922, 16.505413, 4326), plots.geom))



On Sun, Nov 27, 2016 at 9:05 PM, Regina Obe <[hidden email]> wrote:

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:[hidden email]] On Behalf Of Manikanta Kondeti
Sent: Saturday, November 26, 2016 3:16 PM
To: [hidden email]
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    

 


_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/postgis-users


_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/postgis-users