Skip to content

Instantly share code, notes, and snippets.

@fjcunha
Created May 27, 2016 17:55
Show Gist options
  • Save fjcunha/496875388e1eca05afd2b201f342b0e8 to your computer and use it in GitHub Desktop.
Save fjcunha/496875388e1eca05afd2b201f342b0e8 to your computer and use it in GitHub Desktop.
Formula to calcule Distance between two geoPoints
SQRT(
POW(69.1 * (latitude - [startlat]), 2) +
POW(69.1 ([startlng] - longitude) * COS(latitude / 57.3), 2)) AS distance
FROM TableName HAVING distance < 25 ORDER BY distance;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment