Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat spatial indexing algorithm should I use?
    primarykey
    data
    text
    <p>I want to implement some king of spatial indexing data structure for my <code>MKAnnotations</code>. Currently it's horribly slow when I try to filter them based on distance criteria ( 3-4k of locations, currently extremely slow with a simple double <code>for</code> ... ).</p> <p>I'd like to create clusters of <code>MKAnnotations</code>, to decide if it is close to another. Also, these locations are in a somewhat (creation) order and a "previous"/"next" functionality would be needed to "jump" between (this is not a must). I've read about <code>kd-tree</code> and <code>r-tree</code> structures and they both seem to meet the fast distance/neighbor obtaining option for filtering/clustering, but I'm not sure which is the best for me or if there are other options too. What algorithm/data structure should I use ?</p> <p><strong>Update:</strong> I store these locations in a Core Data database, they represent a path. When the map is opened they are fetched into an array and then I just use that array for distance calculations and annotation creation. When the user moves/zooms the map, I loop through them and decide what needs to be changed on map, so it is kinda static the whole stuff. As I understood, if I'd be using a tree, I could store the locations there and when a zoom/move happens I just search through it and obtain the ones in the new region. Is this true ? </p> <p>Even in the dynamic case, when I can add new locations to this array, it would be a single insertion and it's happening rarely.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload