I tried to do the same to sort the results by distance from the location. Here is one of my questions:
Key data and kernel location
It turned out that you need to load all the places in memory to compare them. I ended up using SQLite, which is harder to implement, but has caused far fewer headaches for this kind of function.
This may not be the answer you need, but if you have a large dataset, I would recommend SQLite. As a result, it became easier and easier for me to cope.
nevan king
source share