SHARE
TWEET

Untitled

a guest Jun 16th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* Get the point of interest's geometry and save it in a common table expression */
  2. WITH point_of_interest AS (
  3.     SELECT
  4.         geom
  5.     FROM
  6.         my_table
  7.     WHERE
  8.         id = 1
  9. )
  10.  
  11. /* Select everything from all the other points if they are within 100m */
  12. SELECT
  13.     mt.*
  14. FROM
  15.     my_table AS mt,
  16.     point_of_interest AS poi
  17. WHERE
  18.     id != 1 -- Don't return the point of interest itself
  19.     AND
  20.     ST_DWithin(poi.geom, mt.geom, 100) -- Return only the points within 100 m
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top