I’m trying to choose places from my postgis db that are inside a certain bounding box. I’m trying to accomplish this with this query:
//latlong - latitude, longitude of a place
SELECT * FROM places WHERE St_Contains(St_GeomFromText('Polygon((:top_left_long :top_left_lat, :bottom_right_long :bottom_right_lat))'), latlong);
First of all – I get the following error:
Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: :top_left_lat
What does it mean? And the second issue – am I feeding these parameters in good order? I mean – first longitude, then latitude?
Here is a query I used in an old project:
the_geom was my geometry column
Note: MakeBox2D take top-left and right-bottom