0

データをSQLからelasticsearchに移動しようとしています。多角形を追加しようとするたびに例外があります。

WktReader を使用して WKT を読み取り、それを JeoJson クラスに追加します。クラスにはタイプ (ポリゴン) と座標が含まれます

座標ビルド (c#):

{ [ [ [ x,y ], [ x,y ], [ x,y ], [ x,y ], [ x,y ] ] ] }

エラスティックサーチでのGEOMETRIESマッピング:

"GEOMETRIES" : {
    "type" : "nested",
    "properties" : {
        "AREA" : { "type" : "double" },
        "CENTROID" : {
            "type" : "geo_point",
            "geohash" : true,
            "geohash_preflix" : true
        },
        "KEY" : {
            "type" : "string",
            "index" : "not_analyzed"
        },
        "SHAPE" : {
            "type" : "geo_shape"
        }
    }
}

2 つの例外があります。

1

MapperParsingException[failed to parse [GEOMETRIES.SHAPE]]; nested: IllegalArgumentException[Invalid number of points in LinearRing (found 3 - must be 0 or >= 4)];

2

MapperParsingException[failed to parse [GEOMETRIES.SHAPE]]; nested: InvalidShapeException[provided shape has duplicate consecutive coordinates at: (number, number, NaN)];
4

1 に答える 1

0

私はそれを解決しました。

IllegalArgumentException は、ポリゴンの最初と最後の座標が重心であり、2 番目と最後の座標のみが実際の最初と最後の点であったためです。最初と最後のポイントを削除しただけです。

InvalidShapeException は、一部のポリゴンが基本的に線であり、elasticsearch が気に入らないためです。

結局どちらのミスも手に入れたポリゴンがめちゃくちゃだったから

于 2015-11-26T15:27:12.883 に答える