elasticsearch Elastictic搜索摄取循环处理器问题

x6492ojm  于 2022-12-17  发布在  ElasticSearch
关注(0)|答案(1)|浏览(130)

我正在尝试插入一个使用圆处理器生成圆点的位置。文档中的位置[30,10]是使用圆点正确生成的。docs:圆处理器|ElasticSearch指南[8.5]|弹性

PUT _ingest/pipeline/polygonize_circles
{
  "description": "translate circle to polygon",
  "processors": [
    {
      "circle": {
        "field": "circle",
        "error_distance": 1,
        "shape_type": "geo_shape"
      }
    }
  ]
}

PUT circles
{
  "mappings": {
    "properties": {
      "circle": {
        "type": "geo_shape"
      }
    }
  }
}
 

PUT circles/_doc/2?pipeline=polygonize_circles
{
  "circle": {
    "type": "circle",
    "radius": "40m",
    "coordinates": [35.539917, -78.472000]
  }
}

GET circles/_doc/2

But if I use another location. The generated coordinate looks like an oval with the wrong radius.

my location [35.54171753710938, -78.472]

created coordinates:
"circle": {
            "coordinates": [
              [
                [
                  35.54171753710938,
                  -78.472
                ],
                [
                  35.54112406581135,
                  -78.47173430472324
                ],
                [
                  35.540630197847186,
                  -78.47167003953963
                ],
                [
                  35.540375564960186,
                  -78.47165140797998
                ],
                [
                  35.54021828908823,
                  -78.47164529506406
                ],
                [
                  35.54010640465818,
                  -78.47164274491611
                ],
                [
                  35.54001650261309,
                  -78.47164162397662
                ],
                [
                  35.53993651647515,
                  -78.47164003979641
                ],
                [
                  35.539858062238046,
                  -78.47164049555624
                ],
                [
                  35.53977439153409,
                  -78.47164207973975
                ],
                [
                  35.5396750942597,
                  -78.47164321572573
                ],
                [
                  35.5395458932956,
                  -78.47164846905713
                ],
                [
                  35.539348254773515,
                  -78.47165779735127
                ],
                [
                  35.53899878746994,
                  -78.47169061817682
                ],
                [
                  35.53833938849573,
                  -78.47182842440924
                ],
                [
                  35.53833938849573,
                  -78.47217157559075
                ],
                [
                  35.53899878746994,
                  -78.47230938182317
                ],
                [
                  35.539348254773515,
                  -78.47234220264872
                ],
                [
                  35.5395458932956,
                  -78.47235153094286
                ],
                [
                  35.5396750942597,
                  -78.47235678427425
                ],
                [
                  35.53977439153409,
                  -78.47235792026024
                ],
                [
                  35.539858062238046,
                  -78.47235950444374
                ],
                [
                  35.53993651647515,
                  -78.47235996020358
                ],
                [
                  35.54001650261309,
                  -78.47235837602337
                ],
                [
                  35.54010640465818,
                  -78.47235725508388
                ],
                [
                  35.54021828908823,
                  -78.47235470493592
                ],
                [
                  35.540375564960186,
                  -78.47234859202001
                ],
                [
                  35.540630197847186,
                  -78.47232996046036
                ],
                [
                  35.54112406581135,
                  -78.47226569527675
                ],
                [
                  35.54171753710938,
                  -78.472
                ]
              ]
            ],
            "type": "Polygon"
          }

coordinates mapping on google maps
这是一个问题还是它的工作如预期?因为坐标不是一个圆,所以它影响了搜索结果.

ubbxdtey

ubbxdtey1#

你需要用longitude first and then latitude指定你的坐标数组,我想你做了相反的事情,你的圆在南极洲的中间。
如果你这样做:

PUT circles/_doc/2?pipeline=polygonize_circles
{
  "circle": {
    "type": "circle",
    "radius": "40m",
    "coordinates": [-78.472000, 35.539917]
  }
}

那么你的圆看起来就不再是椭圆了:

official doc
在GeoJSON和WKT以及Elasticsearch中,正确的坐标顺序是坐标数组中的longitude,latitude(X,Y),这与许多地理空间API(如Google Maps)不同,后者通常使用通俗的latitude,longitude(Y,X)。

相关问题