Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flushing Operation on Indexes #107

Closed
achapkowski opened this issue Jun 8, 2018 · 2 comments
Closed

Flushing Operation on Indexes #107

achapkowski opened this issue Jun 8, 2018 · 2 comments
Milestone

Comments

@achapkowski
Copy link

I see on the Spatial index, there is an option to close the index file, is there a way to flush?

Per Python Doc:

Flush the write buffers of the stream if applicable. This does nothing for read-only and non-blocking streams.

I think this would help for the creation of very large spatial indexes, so you can write very large indexes to disk without holding everything in memory before writing.

Desired Workflow:

from rtree import Index
idx = Index('rtree.index')

for cnt, g in enumerate(geoms):
    idx.insert(cnt, g.bounds())
    if cnt == 10000:
         idx.flush()

I don't know if this is possible since it's just a wrapper on the c libraries, but I figured I'd ask here first.

Thanks

@hobu
Copy link
Member

hobu commented Jun 8, 2018

There is no flush method on the Python implementation, but there is one in the libspatialindex C API called Index_Flush that could be wrapped and used. You might also get the same effect by forcing the index to close and open again.

@hobu
Copy link
Member

hobu commented Nov 11, 2019

Added in #119

@hobu hobu closed this as completed Nov 11, 2019
@hobu hobu added this to the 0.9.0 milestone Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants