n-dimensional kdtree spatial indexing