【问题标题】:calculate distance between points and a center within a radius HIVE计算点与半径 HIVE 内的中心之间的距离
【发布时间】:2021-01-22 23:28:50
【问题描述】:

我正在使用以下方法从我的蜂巢数据库中获取距离我的中心 200m 以内的所有点。

SELECT * FROM mytable
WHERE ST_GeodesicLengthWGS84(ST_SetSRID(ST_LineString(array(ST_Point(longitude_of_center, 
latitude_of_center), 
ST_Point(longitude_of_point, latitude_of_point))), 4326)) <= 200;

拜托,我还需要将所选点与中心之间的距离作为我的查询结果的一部分作为新列 DIST。

【问题讨论】:

    标签: hive gis esri


    【解决方案1】:

    您可以从与中心配对的每个选定点创建一个 LineString,然后在每个这样的 LineString 上调用 GeodesicLengthWGS84。这将与您在 where 子句中的 Length 调用相同,但也会添加到列投影中(类似于select *, ST_GeodesicLengthWGS834(...) from ...

    (披露:Esri Spatial Framework for Hadoop 的合作者)

    【讨论】:

      猜你喜欢
      • 2018-11-25
      • 2014-11-29
      • 2014-02-28
      • 2010-10-30
      • 1970-01-01
      • 2022-01-08
      • 2021-01-14
      相关资源
      最近更新 更多