Quantcast
Channel: How to deal with finding nearby locations when given a zip code or city? - Database Administrators Stack Exchange
Viewing all articles
Browse latest Browse all 2

Answer by Evan Carroll for How to deal with finding nearby locations when given a zip code or city?

$
0
0

What you want is ST_DWithin. That will use an index.

SELECT ascii_nameFROM geonameWHEREST_DWithin(  ST_SetSRID(ST_MakePoint(-122.67621 45.52345), 4326),  the_geom,  16093);

You probably want to use geography rather than geometry.


Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>