[postgis-users] where intersects(the_geom,foobox) = woes

Paul Ramsey pramsey at refractions.net
Wed Sep 1 08:50:00 PDT 2004


POLYGON((
671357.696781 4226841.65215,
671357.696781 4226841.65215,
671357.696781 4226841.65215,
671357.696781 4226841.65215))

Your polygon is invalid... it has no dimension to it... the && operator 
does not care, it just does min/max tests using whatever coordinates 
touch it. But intersects() definitely does care.  Give you box some 
width and height, you will find that things work better.

On Tuesday, August 31, 2004, at 10:03 PM, Fred McDavid wrote:

> Hi,
>
> I'm having trouble with the intersects (also tried overlaps, crosses 
> and
> contains with the same result).  Using the && operator, I get two rows
> returned, but when I add an "and intersects(...)" clause, I get no 
> results.
>
> The following works as expected:
>
> select gid,the_geom from staunton_parcels where the_geom &&
> GeometryFromText('POLYGON((671357.696781 4226841.65215,671357.696781
> 4226841.65215,671357.696781 4226841.65215,671357.696781 
> 4226841.65215))',-1);
>
> but this does not:
>
> select gid,the_geom from staunton_parcels where the_geom &&
> GeometryFromText('POLYGON((671357.696781 4226841.65215,671357.696781
> 4226841.65215,671357.696781 4226841.65215,671357.696781 
> 4226841.65215))',-1)
> and intersects(the_geom,GeometryFromText('POLYGON((671357.696781
> 4226841.65215,671357.696781 4226841.65215,671357.696781
> 4226841.65215,671357.696781 4226841.65215))',-1));
>
> Am I missing something or is there a more appropriate way of finding 
> the
> shapes that "intersect"  (I may not fully understand this from a gis
> perspective...what I'm trying to do amounts to a select-by-rectangle 
> feature
> on all of the mapping applications I've seen) a shape/poly/line?
>
> Regards,
>
> Fred McDavid
>
> ------------ VERSION INFO -----------------
> fred at vespucci:~$ dpkg -l | egrep -e "gis|postgres"
> ii  libpostgis     0.8.2-1        spatial extensions for postgresql 
> (library)
> ii  postgis        0.8.2-1        spatial extensions for postgresql
> ii  postgis-bin    0.8.2-1        spatial extensions for postgresql 
> (binaries)
> ii  postgresql     7.4.2-4        Object-relational SQL database, 
> descended fr
> ii  postgresql-cli 7.4.2-4        Front-end programs for PostgreSQL
> ii  postgresql-con 7.4.2-4        Additional facilities for PostgreSQL
>
>
> -- 
> ==========================================================
> Fred R. McDavid, III
>   540-248-0838
>     frm at bitdaddy.com
>       BitDaddy Systems, Inc
>        * Complex System Design, Management, and Hosting
> ==========================================================
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
      Paul Ramsey
      Refractions Research
      Email: pramsey at refractions.net
      Phone: (250) 885-0632




More information about the postgis-users mailing list