1

I need to create code that given a GPS location point (lat,lon) will find the top 3 closest points from a huge point collection (OSM nodes).

The first option is to have the huge point collection stored in a database and create spatial indexes. Then use a query with built-in spatial methods to get the results. I consider this approach not to be the fastest since the whole querying proccess will require time consuming transactions between software and database. Correct me if I am wrong.

The second option is to have the entire point collection loaded in memory as the program starts. I believe this approach will have better performance. Obviously there is a need to create indexes to avoid iterating through the entire collection since doing so will make performance slower than using a database.

But I do not know how to create indexes in a c# data collection. Is there any .Net library or other approach that indexes in memory spatial data in order to perform fast queries on them?

EDIT: This question although similar to the one considered as duplicate it introduces the question whether database or in-memory approach has better performance.

jayt.dev
  • 975
  • 6
  • 14
  • 36
  • https://www.leapinggorilla.com/Blog/Read/1005/spatial-search-in-lucenenet – L.B Jul 24 '15 at 09:26
  • 1
    For the in-memory representation of your data, you might want to take a look at [Quadtree](https://en.wikipedia.org/wiki/Quadtree). – Corak Jul 24 '15 at 10:04
  • Yes this is a good idea and I am curently looking at it. I edited my question to distinguish it from the one considered duplicate. – jayt.dev Jul 25 '15 at 11:08

0 Answers0