I have 1.5 million data points and I need to find all the data points within 300 meters of a specific location.  I have a GiST index set on my "location" (geom) column and it is Vacummed and Analyzed.
 
I'm trying to make my query but I'm not sure how to set the bounding box.  I'd like the box to be no closer than 300 meters to my query point.  How do I set the BOX3D inputs?  I don't understand the "Units".
 
SELECT
    ec,
    long,
    lat,
    distance_spheroid (
        location,
        SetSRID(MakePoint(-87.983439, 42.042663),4326),
        'SPHEROID["WGS_1984",6378137,298.257223563]'
    ) as distance
FROM
    best_ec
WHERE
    location
    && 'BOX3D(90900 190900, 100100 200100)'::box3d AND
    distance_spheroid(
        location,
        SetSRID( MakePoint(-87.983439, 42.042663), 4326 ),
        'SPHEROID["WGS_1984",6378137,298.257223563]'
    ) < 300
ORDER BY
    distance_spheroid(
      & nbsp; location,
        SetSRID( MakePoint(-87.983439, 42.042663), 4326 ),
        'SPHEROID["WGS_1984",6378137,298.257223563]'
    )
 
 
Thanks,
Adam
_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to