I have got long/lat coordinates with altitude in SQLite database.
Some example data:
latitude longitude altitude
------------------------------
48.003333 11.0 652
48.036667 11.000833 651
48.280833 11.000833 533
Now i want some SQL query which will give me closest altitude to given latitude/longitude coordinates so for example
Given lat/long will be 48.023445/11.000733 so the closest is altitude 651 with lat/long 48.036667/11.000833. Tried to search a lot of forums but nothing usefull. Everywhere are examples on one variable or very slow queries. I need this query really fast and saw some solution based on UNIONS. I need it fast because i will make about 1,5 milions of queries on this table. I am using transactions and indexing.