I formatted the question body to make this a bit more visible: the coordinates you said you got from map.getBounds() make up a box with zero area - it's effectively a point, as immediately pointed out by @user30184.
For that to match with &&, the geom in your map_locations would have to happen to be that exact same point, a line (more or less) running through it, a polygon that covers that spot or a collection that includes one of those.
That ST_MakeBox2D() could cover 12.5%-25% of the surface of the globe in some cases:
ST_MakeBox2D(ST_Point(latitude, longitude), ST_Point(longitude, latitude) ) ST_Point() accepts lon/lat:
geometry ST_Point(float x, float y);
…
For geodetic coordinates,Xis longitude andYis latitude
with cte as (select st_setsrid(ST_MakeBox2D(ST_Point(90,0), ST_Point(0,90)), 4326) AS geom ) select st_astext(geom), st_area(st_transform(geom,3857)) as area_in_3857, st_area(geom::geography(Polygon,4326)) as area_as_geography from cte; | st_astext | area_in_3857 | area_as_geography |
|---|---|---|
| POLYGON((0 0,0 90,90 90,90 0,0 0)) | 2.429835233887958e+15 | 63758202715511.07 |
It still won't necessarily && with your geom, and if it does, I'm not sure that's really what you wanted to find.