如何在弹性搜索中处理自相交的 GeoJson 多边形

How to handle self-intersecting GeoJson polygons in Elastic search

我们正在使用 Elastic Search 中的 shape 数据类型为地理 json 多边形编制索引。多边形是从外部来源提供给我们的。 索引时,一些多边形失败并显示以下消息。

"Unable to Tessellate shape [[12.775555, 61.54487] [12.797356, 61.53186] [12.795639, 61.549286] [12.832375, 61.54536] [12.775555, 61.54487] ]. Possible malformed shape detected."

我们认为该问题与自相交多边形有关。根据例如 https://geojsonlint.com,多边形似乎是有效的。以下是自相交多边形的示例:

{
        "type": "Polygon",
        "coordinates": [
          [
            [
              12.775554656982422,
              61.54486837329203
            ],
            [
              12.797355651855469,
              61.53186079051699
            ],
            [
              12.795639038085938,
              61.54928480379444
            ],
            [
              12.832374572753906,
              61.54535911881558
            ],
            [
              12.775554656982422,
              61.54486837329203
            ]
          ]
        ]
      }

似乎表明正确的方法是将自相交的多边形拆分为多个多边形,以便将上述多边形拆分为2个三角形。 然而上面的 post 也发现了一个 bug in Lucene,所以我们有点困惑。

那么,我们的问题是,在 Elasticsearch 中索引自相交多边形的建议方法是什么?

提前致谢!

what is the suggested way to index self-intersecting polygons in Elasticsearch?

您无法为 self-intersecting 多边形编制索引。它们必须符合 OGC 规范 (http://portal.opengeospatial.org/files/?artifact_id=25355)。

此外,您分享的多边形让我想知道您生成这些多边形的方式是否存在问题。在将这样的多边形拆分为两个三角形之前,我会尝试理解为什么会生成这样的形状?