2

Can anybody tell me how I can get the distance from a given longitude, latitude to a POI (longitude, latitude) stored in SQL Server DB?

Dharman
  • 30,962
  • 25
  • 85
  • 135
Martin
  • 790
  • 2
  • 9
  • 24

1 Answers1

3

While not a SQL answer, I always recommend this explanation for how to calculate distances between lat-lng - http://www.movable-type.co.uk/scripts/latlong.html

For SQL Server, assuming you are using SQL Server 2008, then you can use the native SQL geography types. However, sadly I don't think these map well to Linq-2-Sql so you will probably need to wrap them within stored procedures.

See:

Stuart
  • 66,722
  • 7
  • 114
  • 165