Created
January 9, 2012 21:50
-
-
Save kevinmcmahon/1585140 to your computer and use it in GitHub Desktop.
Spatial query to find 5 closest landmarks to a lat/long in Chicago
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- distance units in planar degrees. 4326 is WGS 84 and the long lat units are degrees | |
| SELECT | |
| ST_Distance(ST_GeomFromText('POINT(-87.6348345 41.8786207)', 4326), landmarks.the_geom) AS planar_degrees, | |
| name, | |
| architect | |
| FROM landmarks | |
| ORDER BY planar_degrees ASC | |
| LIMIT 5; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment