[postgis-users] && BBOX Question

Dylan Lorimer edylan at google.com
Tue Apr 10 23:33:33 PDT 2007


Hi,

I'm curious if anyone can quickly see what I may be doing wrong here. I'm
trying to restrict a query such that the geometry falls within a specified
BBOX. Basic PostGIS stuff....right?

However, for the following query, I'm not expecting to get any results, as
the bbox specified has no points lying within it. And yet I get the result
below.

BOX3D is specified as (xmin ymin, xmax ymax) right?

So here's the query:

 SELECT AsText(the_geom) AS the_geom, FACILITY_N, OBJECTID, FACILITY_I,
DEPTNAME FROM poi_2 WHERE lower(FACILITY_N) LIKE '%lafa%' OR lower(OBJECTID)
LIKE '%lafa%' OR lower(FACILITY_I) LIKE '%lafa%' OR lower(DEPTNAME) LIKE
'%lafa%' AND the_geom && SetSRID('BOX3D(-121.00 38.000, -119.00 40.00
)'::box3d,4326);
        the_geom         |        facility_n        | objectid | facility_i
|              deptname
-------------------------+--------------------------+----------+------------+------------------------------------
 POINT(-122.497 37.7771) | LAFAYETTE SCHOOL (ELEM.) | 1969     | 0000003158
| SF Unified School District (SFUSD)

Here's the table description:

\d poi_2;
           Table "public.poi_2"
   Column   |       Type        | Modifiers
------------+-------------------+-----------
 facility_n | character varying |
 objectid   | character varying |
 facility_i | character varying |
 deptname   | character varying |
 the_geom   | geometry          |
Indexes:
    "deptname_gepoi_2_idx" btree (lower(deptname::text))
    "facility_i_gepoi_2_idx" btree (lower(facility_i::text))
    "facility_n_gepoi_2_idx" btree (lower(facility_n::text))
    "objectid_gepoi_2_idx" btree (lower(objectid::text))
    "the_geom_gepoi_2_idx" gist (the_geom)
Check constraints:
    "enforce_dims_the_geom" CHECK (ndims(the_geom) = 2)
    "enforce_geotype_the_geom" CHECK (geometrytype(the_geom) = 'POINT'::text
OR the_geom IS NULL)
    "enforce_srid_the_geom" CHECK (srid(the_geom) = 4326)

Any ideas?
Cheers,
Dylan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20070410/a49bfeb5/attachment.html>


More information about the postgis-users mailing list