Sql 查找半径为重叠的地质点
正如你在下面看到的,我有 3具有一定半径的地质点A、B、CSql 查找半径为重叠的地质点,sql,mongodb,
elasticsearch,geolocation,geometry,Sql,Mongodb,
elasticsearch,Geolocation,Geometry,正如你在下面看到的,我有 3具有一定半径的地质点A、B、C 1地质点K 我想找到所有半径与K Geo重叠的地质点 所以答案应该是B,C 那么如何才能做到这一点呢 目前我正在使用Mongodb。但是任何其他数据库也可以。这个问题是基于意见的,就像“任何其他数据库都可以”一样。 但为了记录在案,在ES中执行此操作的方法如下: PUT circles { "mappings": { "properties": { "location": { "type": "
1地质点K 我想找到所有半径与K Geo重叠的地质点 所以答案应该是B,C 那么如何才能做到这一点呢
目前我正在使用Mongodb。但是任何其他数据库也可以。这个问题是基于意见的,就像“任何其他数据库都可以”一样。 但为了记录在案,在ES中执行此操作的方法如下:
PUT circles
{
"mappings": {
"properties": {
"location": {
"type": "geo_shape",
"strategy": "recursive"
}
}
}
}
PUT circles/_doc/A
{
"location": {
"type": "circle",
"coordinates": [
16.34817123413086,
48.20968893477074
],
"radius": "2km"
}
}
PUT circles/_doc/B
{
"location": {
"type": "circle",
"coordinates": [
16.374435424804688,
48.20122291334052
],
"radius": "3km"
}
}
PUT circles/_doc/C
{
"location": {
"type": "circle",
"coordinates": [
16.386451721191406,
48.21586595914765
],
"radius": "4km"
}
}
GET circles/_search
{
"query": {
"geo_shape": {
"location": {
"shape": {
"type": "point",
"coordinates": [
16.386795043945312,
48.208773756674425
]
},
"relation": "intersects"
}
}
}
}
屈服
[
{
"_index":"circles",
"_type":"_doc",
"_id":"B",
"_score":1.0,
"_source":{
}
},
{
"_index":"circles",
"_type":"_doc",
"_id":"C",
"_score":1.0,
"_source":{
}
}
]
我认为您需要一个第三方库,例如。几乎每种语言都应该有类似的开源软件包。一个好的起点可能是你知道如何在MongoDB中实现它吗?不知道。这可能会有帮助