Dear Sedona Team,

I am trying to implement spatial queries using SedonaSQL in Pure SQL
environment, from data stored in Hive tables, following the steps mentioned
in the link below.

https://sedona.apache.org/latest-snapshot/tutorial/sql-pure-sql/

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 optimised way to implement the above queries
(especially k-NN).

Thanks & Regards
Vigneswaran

Reply via email to