【问题标题】:Is it possible to make OData's spatial queries over Web API是否可以通过 Web API 进行 OData 的空间查询
【发布时间】:2014-01-29 16:37:51
【问题描述】:

我正在尝试允许对我的 Entity Framework 的实体 (OData) 进行查询。 我的一些实体属于 DBGeography,我想对它们进行查询。 我在这样的查询上失败了:

api/towns?$filter=geo.distance(Location,Point (0.0 0.0)) lt 100

“')' 或 ',' 预计在 'geo.distance(Location,Point (0.0 0.0)) lt 100' 中的位置 28。”

【问题讨论】:

  • 你搞清楚了吗?!

标签: asp.net-web-api odata entity-framework-6


【解决方案1】:

根据 ODATA.org (link) (link) 应该是

http://domain.com/api/controller?
$filter=geo.distance(Location, geography'Point(-71.798 45.144)') lt 10000

但是 web api 会抛出这个异常:

"Message": "An error has occurred.",
"ExceptionMessage": "Unknown function 'geo.distance'.",
"ExceptionType": "System.NotImplementedException",

我猜目前不支持,希望很快就会支持。 ASP.NET's Codeplex 上有关于它的讨论,但没有答案。

【讨论】:

  • 哦,现在都在一个地方!我现在已经放弃了 ODATA。我希望微软能尽快完成这项工作!
猜你喜欢
  • 2017-01-17
  • 2019-07-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-09-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多