I am using the following query in my db:
SELECT bg_id, ST_AsGeoJSON(the_geom) FROM bg WHERE bg.the_geom && ST_MakeEnvelope(xxx, xxx, xxx, xxx);
It seems to execute alright but when I draw out the geos on my map (I'm using Leaflet for this) it includes a bunch of geos that are not within the bounds I provided.
For a little more detail as to what exactly I'm trying to accomplish... I have a map on a webpage. As the user navigates throughout the map the bounds of the map are sent back to the db and then the db should send back geos for only what is within the current view. This seems to only be working if the map is zoomed in very close. If I zoom out at all it begins to include lots of geos that I am not looking for. I would only like to include geos that are ENTIRELY within the view.