【发布时间】:2017-03-17 15:19:05
【问题描述】:
我有一张如下表:
id_center|latitude_of_center|longitude_of_center|id_point|latitude_of_point|longitude_of_point
表格有数百万行
我正在尝试获取输出,该输出将显示每个 id_center 哪些 id_points 在 5 英里半径范围内,以及距离有多远,按降序排序。每一行都是完全填充的,因此每个 id_center 在单独的行中都有所有可能的 id_point。这是我迄今为止尝试过的,但我得到的结果是空的:
hive> add jar /home/me/gis-tools-for-hadoop/samples/lib/esri-geometry-api.jar;
Added [/home/me/gis-tools-for-hadoop/samples/lib/esri-geometry-api.jar] to class path
Added resources: [/home/me/gis-tools-for-hadoop/samples/lib/esri-geometry-api.jar]
hive> add jar /home/me/gis-tools-for-hadoop/samples/lib/spatial-sdk-hadoop.jar;
Added [/home/me/gis-tools-for-hadoop/samples/lib/spatial-sdk-hadoop.jar] to class path
Added resources: [/home/me/gis-tools-for-hadoop/samples/lib/spatial-sdk-hadoop.jar]
hive> create temporary function ST_GeodesicLengthWGS84 AS 'com.esri.hadoop.hive.ST_GeodesicLengthWGS84';
OK
Time taken: 0.014 seconds
hive> create temporary function ST_SetSRID AS 'com.esri.hadoop.hive.ST_SetSRID';
OK
Time taken: 0.008 seconds
hive> create temporary function ST_LineString AS 'com.esri.hadoop.hive.ST_LineString';
SELECT * FROM mytable WHERE ST_GeodesicLengthWGS84(ST_SetSRID(ST_LineString(latitude_of_center, longitude_of_center, latitude_of_point, longitude_of_point), 4326)) <= 8046.72
【问题讨论】: