Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
528
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. ID | Coordinate
  2. -----------------------------
  3. 1 | POINT(192.938 -28.348)
  4. 2 | POINT(57.349 -88.482)
  5.  
  6. SELECT * FROM places WHERE ST_DWithin(places.Coordinate, ST_GeographyFromText('POINT(195.888 -28.348)'), 16093.4);
  7.  
  8. SELECT
  9. id,
  10. coordinate,
  11. v2.geogwkt,
  12. ST_DWithin(
  13. coordinate::geography,
  14. geogwkt::geography,
  15. 16093.4
  16. ),
  17. ST_Distance( coordinate::geography, geogwkt::geography )
  18. FROM ( VALUES
  19. ( 1, 'POINT(192.938 -28.348)' ),
  20. ( 2, 'POINT(57.349 -88.482)' )
  21. ) AS v1(id, coordinate)
  22. CROSS JOIN ( VALUES ('POINT(195.888 -28.348)') )
  23. AS v2(geogwkt);
  24.  
  25. id | coordinate | geogwkt | st_dwithin | st_distance
  26. ----+------------------------+------------------------+------------+------------------
  27. 1 | POINT(192.938 -28.348) | POINT(195.888 -28.348) | f | 289222.77513405
  28. 2 | POINT(57.349 -88.482) | POINT(195.888 -28.348) | f | 6992543.20903735
  29. (2 rows)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement