【发布时间】:2016-09-16 00:12:22
【问题描述】:
我正在为 Azure 搜索使用以下查询:
$filter=geo.intersects(coordinate, geography'POLYGON((1.136 44.733, 1.316 44.733, 1.316 44.553, 1.136 44.553, 1.136 44.733))')
这应该返回该多边形内的所有点,该多边形是法国西南部的一个小区域。不幸的是,Azure 搜索从多边形外部返回结果。
我认为不正确的结果示例(已更正,请参阅 cmets):
- lon=5.299151,lat=44.695285,
- lon=0.397723,lat=44.668628,
多边形中的点是顺时针输入的(在相关问题中提到过),但结果仍然不正确。
关于修复查询有什么建议吗?
我正在使用以下代码来提供索引:
公共类几何
{
public Geometry(Coordinate c)
{
List<double> GeoList = new List<double>();
GeoList.Add((double)c.Longitude);
GeoList.Add((double)c.Latitude);
type = "Point";
coordinates = GeoList;
}
public string type { get; set; }
public IList<double> coordinates { get; set; }
}
【问题讨论】:
-
在你的坐标看起来不正确的例子中,看起来 lon 和 lat 被交换了。这是一个错字,还是您看到的实际结果?
-
它们以经纬度顺序返回(我已编辑问题以反映正确的顺序):“坐标”:{“类型”:“点”,“坐标”:[5.299151, 44.695285 ], "crs": { "type": "name", "properties": { "name": "EPSG:4326" } } }
-
为了更正我之前的评论,因为我无法再编辑该评论:他们确实错了,我把它们弄混了。应该是这样的解释。我会测试并告诉你结果。
-
您的 $filter 查询对我来说看起来不错。可能是索引中的坐标向后。
-
谢谢,我会检查索引代码