Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. SELECT AddGeometryColumn('cities', 'geom', 4326, 'POINT', 2);
  2.  
  3. UPDATE cities SET geom = ST_SetSRID(ST_MakePoint(longitude, latitude), 4326);
  4.  
  5. SELECT *
  6. FROM cities
  7. WHERE ST_DWithin(geom, ST_MakePoint(79.3832,43.6532)::geography, 50000);
  8.  
  9. WHERE ST_DWithin(geom::geography, ST_SetSRID(ST_MakePoint(79.3832,43.6532),4326)::geography, 50000);
  10.  
  11. WHERE ST_DWithin(geom::geography, ST_GeogFromText('SRID=4326;Point(79.3832 43.6532)'), 50000);
  12.  
  13. WHERE ST_DWithin(geom::geography, ST_GeogFromText('SRID=4326;Point(-79.3832 43.6532)'), 50000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement