[postgis-users] ST_Intersects not finding everythng?

Paul Ramsey pramsey at opengeo.org
Thu Jun 7 13:13:30 PDT 2012


Individually your observation does not hold. Testing the literals
pairwise returns true in all cases.

select st_intersects('SRID=4326;POLYGON((-71.0004167
43.0004167,-69.9995833 43.0004167,-69.9995833
41.9995833,-71.0004167 41.9995833,-71.0004167 43.0004167))',
'srid=4326;POLYGON((-70.70785443115230
42.61915358272220,-71.42814556884760 42.61915358272220,-71.42814556884760
42.11182215470750,-70.70785443115230 42.11182215470750,-70.70785443115230
42.61915358272220))');

You'll have to make a data table available that shows this behavior
for others to help.

Best,

Paul

On Thu, Jun 7, 2012 at 12:35 PM, DrYSG <ygutfreund at draper.com> wrote:
> 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.
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users



More information about the postgis-users mailing list