elasticsearch - 如何从中心坐标和半径计算地理边界框
问题描述
我有纬度、经度和位置半径:
lat = 38.7199877874397
long = -116.717434703125
radius = 6477937.81256012 - radius in metrs.
我需要根据此示例计算用于在 Elasticsearch 中过滤的地理边界框: https ://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-bounding-box-query.html#query -dsl-geo-bounding-box-query
地理边界框,例如应该看起来像
"geo_bounding_box": {
"pin.location": {
"top_left": {
"lat": 40.73,
"lon": -74.1
},
"bottom_right": {
"lat": 40.01,
"lon": -71.12
}
}
我尝试使用这个公式:
(X - dX, Y - dY) and (X + dX, Y + dY)
Where:
X - longitude
Y - latitude
dY = 360 * r / R - the earth radius is R, in the same units as r
dX = dY * cos (radians (Y))
但我有错误的数字:
((-397.59384191845777, -321.2800122125603), (164.1589725122078, 398.7199877874397))
我如何计算地理边界框赖特?将不胜感激。
解决方案
推荐阅读
- google-sheets - 我可以使用 Google 表单检查记录在 Google 表格中的学生文书工作的状态吗?
- python - 重塑字典键
- angular - 列出组件更新,同时在角度 7 中从其他组件发布新记录
- scala - 查找databricks错误中所有列的总和
- swift - Vapor 3 - 尝试将登录请求映射到数据库中不存在的模型
- sql - (一个表)获取没有联合的行
- php - Laravel 5.4 - 几个表中的多个关系
- python-3.x - 多处理将 S3 内容主体转换为 pandas DataFrame AWS Sagemaker
- c# - 如何将对象列表从 C# 传递和迭代到 NLua
- javascript - 无法让黑色画布显示在屏幕上