【发布时间】:2013-04-05 04:47:24
【问题描述】:
我可以使用下面的 SQL 来计算一个固定位置与数据库中场地的位置之间的距离。
SELECT Location.STDistance(geography::Point(51, -2, 4326)) * 0.00062137119 FROM Venues
请注意,返回的距离以英里为单位,并且 Location 字段是地理类型。
我想知道 .NET 中的 this 等价物是什么,它会返回相同的值。此方法将具有以下签名:
public static double Distance(location1Latitude, location1Longitude, location2Latitude, location2Longitude) {
return ...;
}
我知道我可以在 .NET 中调用数据库方法,但我不想这样做。我希望有一个公式来计算距离。谢谢
【问题讨论】:
标签: c# .net sql-server sqlgeography geographic-distance