在南极附近插入大多边形时:
"polygon":{
"type":"polygon",
"coordinates":[
[
[
-134.97410583496094,
-61.81480026245117
],
[
-130.1757049560547,
-63.236000061035156
],
[
-125.17160034179688,
-64.40799713134766
],
[
-152.0446014404297,
-75.72830200195312
],
[
143.52340698242188,
-77.68319702148438
],
[
147.41830444335938,
-75.44519805908203
],
[
150.2816925048828,
-73.01909637451172
],
[
-162.17909240722656,
-71.5260009765625
],
[
-134.97410583496094,
-61.81480026245117
]
]
]
},
,返回以下错误 .
{
"error" : "RemoteTransportException[[ISAAC][inet[/x.x.x.x:9300]][indices:data/write/index]]; nested: MapperParsingException[failed to parse [polygon]]; nested: InvalidShapeException[Self- intersection at or near point (-142.29442281263474, -71.62101996804898, NaN)]; ",
"status" : 400
}
该类型的映射是:
卷曲-XPUT http://localhost:9200/files/_mapping/polar -d'
{“polar”:{“properties”:{“startTimeRange”:{“type”:“date”},“endTimeRange”:{“type”:“date”},“productShortName”:{“type”:“ string“,”index“:”not_analyzed“},”polygon“:{”type“:”geo_shape“,”tree“:”quadtree“,”precision“:”1000m“}}}}'
预期的形状是穿过日期线(反子午线)的矩形必不可少的 .
看起来形状被解释为穿过子午线的自相交多边形(0 - 经度) .
在elasticsearch中表示预期形状的最佳方法是什么?
1 回答
Dateline和Pole Crossing是一个众所周知的问题 . 日期线交叉在ES 1.4.3中得到修复,但是极点交叉补丁将在未来版本中发布 . 就目前而言(这可能是一个严重的多边形PITA)你必须自己将Polygon打包成一个MultiPolygon(大概是在应用层) .
这是使用您的数据的示例 .
原始的自交多边形(如下图所示:https://gist.github.com/nknize/ea0e103a22bddae13dfb)
使用极地"unwrapping"更正版本(见以下要点:https://gist.github.com/nknize/8e87ee88d3915498507e)
请注意,上面的“已校正”MultiPolygon是一个粗略计算(浮点错误),仅用于此示例 .
不是一个理想的答案,但我希望它有所帮助!