不同中間件經緯度測試

------------mysql------------------------------------
SELECT st_distance(POINT(118.816334, 32.023290),POINT(118.7888900000, 32.01772))*111195 AS distant;

=3113.853200404186

SELECT st_distance_sphere(POINT(118.816334, 32.023290),POINT(118.7888900000, 32.01772)) AS distant;

=2660.4448185827

 

----在線---------------

https://tool.box3.cn/lbs.html

POINT(118.816334, 32.023290),POINT(118.7888900000, 32.01772) = 2658.78

 

-----es-----------------(跟mysql-st_distance_sphere差不多)

POINT(118.816334, 32.023290),POINT(118.7888900000, 32.01772) = 2660.4561920887677

store/_search

{
  "query": {
    "bool": {
      "must": {
        "match_all": {}
      },
      "filter": {
        "geo_distance": { 
          "distance": "1km",
          "theGeom": {
            "lat": 32.023290,
            "lon": 118.816334
          }
        }
      }
    }
  },
  "sort": [ 
    {
      "_geo_distance": { 
        "theGeom": { 
            "lat": 32.023290,
            "lon": 118.816334
        },
        "order": "asc" 
      }
    }
  ]
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章