Answer the question
In order to leave comments, you need to log in
Python + SQLite: how to select records with "nearby" coordinates?
Hey!
It is necessary to select all rows from the table, with coordinates closer than the given threshold from the given coordinate.
The coordinates are stored in the lat and lng columns, respectively
. Mysql is full of examples with the formula for converting to polar coordinates and selecting the nearest records.
But in SQlite, a similar query causes an error, as I understand it, due to the reasonableness of sqlite.
Does anyone have a working example of a database query?
Thank you!
Answer the question
In order to leave comments, you need to log in
In order to be quick, you need to use indexes, and the indexes will roll here only for comparison. So you take a 1x1 degree square around a point, take all the points from there and catch the nearest ones.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question