0

I wonder how I can create a query and select objects that are located within a radius of 50 km.

The information I can use is Longitude and latitude for every object. I would like to set my own location in the query and calculate the objects distance to my position based on its coordinates.

juergen d
  • 195,137
  • 36
  • 275
  • 343
Jan
  • 329
  • 3
  • 16
  • You need to download some geo location database which contains data based on lats and longs. – Nilesh Sep 16 '13 at 14:06

1 Answers1

0

Assuming you're using a geography type, which you should be, use STDistance - see http://technet.microsoft.com/en-us/library/bb933808.aspx

select *  
from yourtable
where place.STDistance(@myposition)<50000
podiluska
  • 50,144
  • 7
  • 94
  • 100