Select to view content in your preferred language

What is the optimized way to execute spatial queries in Hive, using GIS Tools for Hadoop?

465
0
06-04-2023 04:38 AM
vigneshwaran
New Contributor

Dear Esri Team,

I am trying to implement spatial queries in Hive using GIS Tools for Hadoop, following the steps mentioned in the link below.
 
https://github.com/Esri/gis-tools-for-hadoop/tree/master/samples/point-in-polygon-aggregation-hive 
 
The implementation of the queries are as follows
 
1.Circle range query
SELECT COUNT(*) FROM table_name WHERE
ST_Intersects(ST_Buffer(ST_Point(x1,y1), radius), ST_Point(x, y));

2. BBOX range query
SELECT COUNT(*) FROM table_name WHERE
ST_Contains(ST_GeomFromText('POLYGON ((x1 y1, x2 y2, .. , x1 y1))'), ST_Point(x, y));

3. k-NN query (k=10)
SELECT ST_Distance(ST_Point(x1, y1), ST_Point(x, y)) as distance, x, y FROM
table_name ORDER BY distance ASC LIMIT 10;
 
Kindly let me know the optimized way to implement the above queries (especially k-NN).
 
Thanks & Regards
Vigneswaran
0 Kudos
0 Replies