Skip to content

Instantly share code, notes, and snippets.

@ogiovannyoliveira
Created April 9, 2020 14:13
Show Gist options
  • Save ogiovannyoliveira/2ca0fb59fdc6f2a66c95786f899ac1b5 to your computer and use it in GitHub Desktop.
Save ogiovannyoliveira/2ca0fb59fdc6f2a66c95786f899ac1b5 to your computer and use it in GitHub Desktop.
Pegar todos os dados em um raio de X km de acordo com as coordenadas
SELECT
*
FROM
geo_located_data
WHERE
111.195 * sqrt(power(latitude-($1),2) + power(cos(pi()/180*($2))*(longitude-($2)),2)) < $3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment