libspatialindex/libspatialindex — pull request #40 by hobu (2014-07-27 23:16:22+00:00)
Title: Inaccessible index property IndexIdentifier

I was implementing a custom storage manager the other day and had a few issues getting the IndexIdentifier through the C API. I could always be missing a call to find it somewhere, but my reading of things makes it appear to be hidden.

Near as I can tell, the IndexIdentifier is set on the PropertySet instance here:

https://github.com/libspatialindex/libspatialindex/blob/53fe4df16d3499f85e2aa6e7805f3cc97714ce66/src/rtree/RTree.cc#L394

That PropertySet is the member on the un-namespaced Index class from the C API here:

https://github.com/libspatialindex/libspatialindex/blob/53fe4df16d3499f85e2aa6e7805f3cc97714ce66/include/spatialindex/capi/Index.h#L70

But the Index_GetProperties call ends up returning the PropertySet from the underlying instance that the unnamespaced Index wraps:

https://github.com/libspatialindex/libspatialindex/blob/53fe4df16d3499f85e2aa6e7805f3cc97714ce66/src/capi/sidx_api.cc#L1170

The two solutions i saw were to either patch each of the indexes to set the IndexIdentifier in the PropertySet that they return, or to return a PropertySet that is some sort of merge between the two Index instances. I'm not super familiar with the library internals so I didn't really know which approach would be preferred. For the time being I just peek into the Index class directly so its not a pressing issue.