[postgis-users] Finding Points with distance to a location.

Adam adam at spatialsystems.org
Fri Dec 29 22:10:10 PST 2006

I've tried:

SELECT point_geom, location_id
 FROM locations
 WHERE Distance(point_geom, 'POINT(-117.13538 32.6857)')

But get error:  argument of WHERE must be type boolean, not type double precision

  ----- Original Message ----- 
  From: Adam 
  To: PostGIS Users Discussion 
  Sent: Saturday, December 30, 2006 12:07 AM
  Subject: [postgis-users] Finding Points with distance to a location.

  I figured this out last year, but can't figure out how I figured it out.  I've read "Mapping Hacks" and "Web Mapping Illustrated" along with what I could find in the WIKI and documentation but can't start to figure it out.

  I have my geometry column named "point_geom" and a unique column named "location_id".

  I want to query the distance of all the points in my "point_geom" column to coords:  Long = -117.13538 :: Lat = 32.6857

  What would the query for this look like?  Is there a comprehensive article or book out that goes in depth into how spatial queries work?

  The output would look like this:

  location_id | distance
  5 | 45.38823
  9 | 50.39952
  1 | 82.39923

  I'm guessing that you'd use distance_spheroid for the calculation.     


  postgis-users mailing list
  postgis-users at postgis.refractions.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20061230/e0018dcd/attachment.html>

More information about the postgis-users mailing list