开发者

LINQ POI proximity

开发者 https://www.devze.com 2023-02-18 11:13 出处:网络
Can anybody tell me how I can get the distance from a given longitude, latitud开发者_运维百科e to a POI (longitude, latitude) stored in SQL Server DB?While not a SQL answer, I always recommend this ex

Can anybody tell me how I can get the distance from a given longitude, latitud开发者_运维百科e to a POI (longitude, latitude) stored in SQL Server DB?


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:

  • getting started with geo types - http://msdn.microsoft.com/en-us/library/bb895266.aspx
  • determining relationships (which includes STDistance) - http://msdn.microsoft.com/en-us/library/bb964709.aspx
0

精彩评论

暂无评论...
验证码 换一张
取 消