相关疑难解决方法(0)

查找经度和纬度最近的位置

我正在开发一个我需要到达附近位置的应用程序,我的Web服务将收到2个参数(十进制经度,十进制纬度)

我有一个表,其中的位置保存在数据库中的经度和纬度字段,

我想找回最近的位置.

有人可以帮忙吗?

这是我的代码:

 var locations = from l in locations

     select l
Run Code Online (Sandbox Code Playgroud)

以下是有关此内容的更多详细信息:我在数据库表中有2个字段(十进制(18,2)null)1个纬度,2个经度,

我有一个方法

public List<Locations>  GetLocation(decimal? Long, decimal? lat) 
{
var Loc = from l in Locations
  //// now here is how to get nearest location ? how to query?
  //// i have also tried Math.Abs(l.Lat - lat) its giving error about nullable decimal always hence i have seted decimal to nullable or converted to nullable
 //// also i have tried where (l.lat - Lat) * (l.lon …
Run Code Online (Sandbox Code Playgroud)

c# linq

28
推荐指数
3
解决办法
3万
查看次数

标签 统计

c# ×1

linq ×1