I have downloaded a dump of OSM data from http://geofrabrik.de as a .pbf file. I have used osm2pgsql to import this data into my postgis-enabled postgres database. I am trying to get the geometries that are contained within a bounding box that I have created. Using ST_Intersects gives more data since that is the intersection of the 'way' and the envelope I created.Using ST_Contains doesn't return anything. My queries are like this:
Using ST_Intersects:
SELECT name, ST_AsText(ST_Transform(way,4326)) FROM planet_osm_polygon WHERE
ST_Intersects (way, ST_Transform(ST_MakeEnvelope((-122.1358332),
(37.494456), (-121.9858223),(37.594456), 94326), 900913));
Using ST_Contains:
SELECT name, ST_AsText(ST_Transform(way,4326)) FROM planet_osm_polygon WHERE
ST_Contains (ST_MakeEnvelope((-122.1358332),
(37.494456), (-121.9858223),(37.594456), 94326), ST_Transform(way,94326));
ST_Intersects seems to return too much data, I just have several megs of data returned. ST_Contains seems to return almost nothing. What is wrong here?