现在的情况
只能通过
来查询到当前数据
遇到的问题是:
索引
存储的数据 经纬度数据存储是一个闭环 首尾坐标相同
我想要达到的结果
kibana查询:
结果:
{
"took" : 14,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [
{
"_index" : "app",
"_type" : "city",
"_id" : "2",
"_score" : 1.0,
"_source" : {
"adcode" : "110112",
"name" : "西城区",
"centroid" : {
"lat" : 39.912934,
"lon" : 116.416718
},
"childrenNum" : 0,
"level" : "district",
"parent" : [
{
"adcode" : 110000
}
],
"subFeatureIndex" : 5,
"location" : {
"type" : "polygon",
"coordinates" : [
[
[
116.325799,
39.896789
],
[
116.32582,
39.891111
],
[
116.320759,
39.881512
],
[
116.321324,
39.875199
],
[
116.326636,
39.876859
],
[
116.335273,
39.875183
],
[
116.341567,
39.876159
],
[
116.344286,
39.873653
],
[
116.349472,
39.873588
],
[
116.35058,
39.86869
],
[
116.38059,
39.871148
],
[
116.399097,
39.872205
],
[
116.397612,
39.898675
],
[
116.396086,
39.89944
],
[
116.395563,
39.907995
],
[
116.392259,
39.907881
],
[
116.392175,
39.92242
],
[
116.399474,
39.923574
],
[
116.396692,
39.928306
],
[
116.396169,
39.94006
],
[
116.394266,
39.940629
],
[
116.393346,
39.957355
],
[
116.38678,
39.957014
],
[
116.387658,
39.96093
],
[
116.390084,
39.968406
],
[
116.394162,
39.969397
],
[
116.394099,
39.972858
],
[
116.380903,
39.972712
],
[
116.380401,
39.968178
],
[
116.370384,
39.967902
],
[
116.371974,
39.948594
],
[
116.356206,
39.944092
],
[
116.352023,
39.950854
],
[
116.352421,
39.943832
],
[
116.341442,
39.941979
],
[
116.332889,
39.944092
],
[
116.327953,
39.942369
],
[
116.333056,
39.938565
],
[
116.334645,
39.922664
],
[
116.335356,
39.898448
],
[
116.337301,
39.89739
],
[
116.325799,
39.896789
]
]
]
}
}
}
]
}
}
最终实现:
java代码实现
根据闭环内的随机坐标 查询到以上数据