微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

地理空间查找返回错误的结果

如何解决地理空间查找返回错误的结果

我在识别一个点是否在多边形内时遇到问题。

对于相同的纬度和经度,有时我会得到正确的结果,但有时不会。如果我搜索更多 ID(因此有更多事件)或更改时间范围(不一定更大),我会得到错误的结果。

导致问题的行:|查找 some_lookup_name 纬度经度

我已使用示例数据和简单的地理空间查找重现了该问题。 id=1 的所有事件都在地理围栏内,id=2 的事件在外。我得到的结果不正确(根据时间排序时不同)。我有两个示例数据源(data_sample_2 已将 id=2 的事件之一的纬度从 51.501835 更改为 51.501836)。

When sorting from earliest to latest,all events are inside

When sorting from latest to earliest,some events for id=1 are outside (which is incorrect)

Removing event with problematic latitude

搜索

index="debug_idx" source="data_sample_1"
| eval time_epoch=_time
| sort 0 _time
| lookup geo_4 latitude longitude
| table id latitude longitude _time time_epoch featureId featureCollection
| noop search_optimization=false

Data_sample_1:

{"location":{"state":{"position":{"timestamp":"2021-01-11T01:14:34.000Z","latitude":51.501835,"longitude":6.906453}}},"ident":{"attr":{"id":"2"}}}}
{"location":{"state":{"position":{"timestamp":"2021-01-11T01:14:34.000Z","ident":{"attr":{"id":"2"}}}}
{"location":{"state":{"position":{"timestamp":"2021-01-06T22:23:23.000Z","latitude":53.500091,"longitude":9.909387}}},"ident":{"attr":{"id":"1"}}}}
{"location":{"state":{"position":{"timestamp":"2021-01-06T22:16:58.000Z","latitude":53.49732,"longitude":9.9082}}},"ident":{"attr":{"id":"1"}}}}
{"location":{"state":{"position":{"timestamp":"2021-01-06T22:13:30.000Z","latitude":53.501923,"longitude":9.910017}}},"ident":{"attr":{"id":"1"}}}}
{"location":{"state":{"position":{"timestamp":"2021-01-06T22:13:15.000Z","ident":{"attr":{"id":"1"}}}}

Data_sample_2:

{"location":{"state":{"position":{"timestamp":"2021-01-11T01:14:34.000Z","latitude":51.501836,"ident":{"attr":{"id":"1"}}}}

Geolookup_4.kml:

<?xml version="1.0" encoding="utf-8" ?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document id="root_doc">
<Schema name="geo_4" id="geo_4">
    <SimpleField name="Name" type="string"></SimpleField>
</Schema>
<Folder>
<name>geo_4</name>
<Placemark>
    <name>{"place":"Location 1","category":"Locations","description":["A"],"subdescription":"01"}</name>
    <Style><Linestyle><color>ff0000ff</color></Linestyle><polyStyle><fill>0</fill></polyStyle></Style>
    <polygon><outerBoundaryIs><LinearRing><coordinates>9.92195,53.51249 9.92848,53.49588 9.89352,53.49482 9.89561,53.51567 9.92195,53.51249</coordinates></LinearRing></outerBoundaryIs></polygon>
</Placemark>
</Folder>
</Document></kml>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。