[postgis-users] Re: SRID, misc queries

Brian Hamlin maplabs at light42.com
Wed Oct 17 20:19:45 PDT 2007


Per-Olof-

   you have gone to the solution faster than I
I came home after taking a break, and wrote simply

SELECT count(*) FROM a b
WHERE
   a.city = 'San Francisco'
AND a.geom_pts &&
   SetSRID( 'BOX(x1 y1,x2 y2)'::box2d, 4326)
AND
   st_within( a.geom_pts, SetSRID( b.the_geom, 4326))

The results are 8x faster, even with a big sloppy box

  Somehow I thought PostGIS would do a simple box before the complex math
Obviously this is not true. I am surprised, but finally am getting 
somewhere

I thank you kindly for you thorough response
I felt as if I was having only bad results
I will take this further now that I have something that is working
best regards from berkeley, CA
   -Brian




More information about the postgis-users mailing list