- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 ES 中有两个 geo_shapes。我需要弄清楚的是了解其中一个形状(绿色)是否包含另一个形状(红色)或与另一个形状(红色)相交的最佳方法。请参阅下面三种不同情况的直观表示:
情况一:很容易检测 - 使用绿色形状坐标进行 Geoshape 查询,其中“relation”=“within”
案例 II:也不是问题 - 使用绿色形状坐标进行 Geoshape 查询,其中“relation”=“INTERSECTS”
情况 III:是一个真正的问题 - 使用绿色形状坐标,我尝试使用“relation”=“INTERSECTS”进行 Geoshape 查询,结果返回红色形状......这是错误的 - 该形状不与彼此(我认为是这样)即使其中一侧相互接触......
有什么方法可以避免这里的误报结果吗?对于如何解决此任务还有其他建议吗?
附注坐标是精确的(例如:13.335594692338)。没有额外的映射,如树级别或精度...
最佳答案
使用 geoshape 存储在 Elasticsearch 中的每个多边形都会转换为字符串列表。为了缩小这个解释的范围,我假设您存储在 Elasticsearch 中的多边形使用 geohash 存储(这是 geoshape 类型的默认值)。
我不想讲太多细节,但看看这张图片
此描述取自 Elasticsearch 文档(详细信息不匹配,但您需要了解全局):
Geohashes divide the world into a grid of 32 cells—4 rows and 8 columns—each represented by a letter or number. The g cell covers half of Greenland, all of Iceland, and most of Great Britian. Each cell can be further divided into another 32 cells, which can be divided into another 32 cells, and so on. The gc cell covers Ireland and England, gcp covers most of London and part of Southern England, and gcpuuz94k is the entrance to Buckingham Palace, accurate to about 5 meters.
您的多边形被投影到矩形列表中,每个矩形都用一个字符串(geohash)表示。此投影的精度取决于树级别。我不知道 Elasticsearch 的默认树级别是多少,但如果您发现误报,那么它对您来说似乎太低了。
树级别为 8 splits the world in rectangles of size 38.2m x 19.1m
。如果多边形的边缘穿过该矩形的中间,它可能会或可能不会(取决于实现)将此矩形的 geohash 表示分配给您的多边形。
要解决您的问题,您需要增加树级别以满足您的需求(有关映射 here 的更多信息)。请注意,尽管索引的大小会大大增加(也取决于形状的大小和复杂性)。作为一个示例,存储 1000 个区域大小的多边形(有些具有 100 个点),树级别为 8 - 索引大小约为 600-700MB。
请记住,无论您选择什么树级别,您总是面临一些误报的风险,因为 geohash 永远不会 100% 精确地表示您的形状。这是精度与性能之间的权衡,geohash 是性能明智的选择。
关于Elasticsearch Geoshape 查询错误结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38880369/
我在 ES 中有两个 geo_shapes。我需要弄清楚的是了解其中一个形状(绿色)是否包含另一个形状(红色)或与另一个形状(红色)相交的最佳方法。请参阅下面三种不同情况的直观表示: 情况一:很容易检
在 ElasticSearch 5 中,我正在创建一个属性: var prop = new Property { Id = page.Id,
我正在使用 Elasticsearch 的 NEST 客户端库为特定类型创建索引。 该类型包含三个 string 属性和一个用于保存 geo_shape 类型的属性(特别是用于 envelope 形状
在JanusGraph中,有一些类似的函数 g.E().has('place', geoWithin(Geoshape.circle(37.97, 23.72, 50))) 搜索place data
如果 GeoShape 就好了页面包含示例或单个属性被分解而不仅仅是文本。 我对 circle 属性特别感兴趣。我想从诺丁汉市中心 (52.953, -1.149) 定义一个半径为 20 英里(~32
在下图中,观察从 Chart.save() 到 HTML 或 JSON Canvas 生成的 map 周围的边框(边框在 Canvas 内,不是 CSS 样式)。 对于任何其他类型的标记,人们希望能够
我试图确定一个多边形(在文档中索引)是否与另一个形状(如圆形)有共同点。 Elasticsearch documentation提供4种关系: 相交; 不相交; 包含; 之内。 我试图从 GeoJSO
有谁知道如何为 GeoShape Circle 创建架构?我正在尝试为我的基于服务的业务设置一个覆盖区域(没有物理位置)。 我想在加利福尼亚州萨克拉门托的各个方向行驶 30 英里 这是我开始的代码
我想匹配 ES 索引中的任何文档,其中一个点在文档多边形 geo_shape 类型内。 基本上,我想查询一个点(即 [2.934211, 42.522377]),并匹配多边形与该点相交的所有文档。 这
我是一名优秀的程序员,十分优秀!