[postgis-users] ST_Intersects not finding everythng?

DrYSG ygutfreund at draper.com
Thu Jun 7 12:35:10 PDT 2012


I am sure this is my faulty understanding.

I have been noticing that some EPSG4326 polygons are only being found only
in a smaller search bbox, not in a larger search bbox. Even though the
larger box is entirely bigger on all sides (I actually get the bbox from
Google Maps). I am using ST_INTERSECTS.

There are many others missing also (all items are rectangular bboxes) , here
are two:

SRID=4326;POLYGON((-72.0004167 43.0004167,-70.9995833 43.0004167,-70.9995833
41.9995833,-72.0004167 41.9995833,-72.0004167 43.0004167))

SRID=4326;POLYGON((-71.0004167 43.0004167,-69.9995833 43.0004167,-69.9995833
41.9995833,-71.0004167 41.9995833,-71.0004167 43.0004167))

Here is the smaller query that finds them:

SELECT * FROM portal.catalog cat WHERE
ST_Intersects(st_geomfromtext('POLYGON((-70.88792721557620
42.49270487579740,-71.24807278442380 42.49270487579740,-71.24807278442380
42.23903905725250,-70.88792721557620 42.23903905725250,-70.88792721557620
42.49270487579740))'::text, 4326), cat.poly) LIMIT 3800;

(this query returns 447 matches)

and here is the outset larger bbox search that somehow does not find these
contained polygons (but it does find many  more new ones:

SELECT * FROM portal.catalog cat WHERE
ST_Intersects(st_geomfromtext('POLYGON((-70.70785443115230
42.61915358272220,-71.42814556884760 42.61915358272220,-71.42814556884760
42.11182215470750,-70.70785443115230 42.11182215470750,-70.70785443115230
42.61915358272220))'::text, 4326), cat.poly) LIMIT 3800;

This one finds 1545 records

(FYI cat.poly is a *geometry*, which always has a rectangular *polygon * in
it.


(Therefore I do NOT suspect the LIMIT statement, since I am not near the
limit)

I have also tried a similar SQL query, and it returns the same record counts
but has the same issue:

            String sql = String.Format("SELECT * FROM portal.catalog cat
WHERE st_geomfromtext('{0}'::text, 4326) && cat.poly LIMIT 3800;", poly);




--
View this message in context: http://postgis.17.n6.nabble.com/ST-Intersects-not-finding-everythng-tp4998091.html
Sent from the PostGIS - User mailing list archive at Nabble.com.



More information about the postgis-users mailing list