Created
July 31, 2014 15:09
-
-
Save Anticom/36ba9e0e488d20ed5955 to your computer and use it in GitHub Desktop.
location based search
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
SELECT | |
dest.sn, | |
dest.ort, | |
dest.kreis, | |
ACOS( | |
SIN(RADIANS(src.lat)) * SIN(RADIANS(dest.lat)) | |
+ COS(RADIANS(src.lat)) * COS(RADIANS(dest.lat)) | |
* COS(RADIANS(src.lon) - RADIANS(dest.lon)) | |
) * 6380 AS distance | |
FROM | |
opengeodb dest | |
CROSS JOIN | |
opengeodb src | |
WHERE | |
src.sn= 3541 | |
AND dest.sn <> src.sn | |
HAVING distance < 10 | |
ORDER BY distance; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://opengeodb.org/wiki/OpenGeoDB_-_Umkreissuche#Orte_im_Umkreis_ermitteln