I am quite familiar how to work with the Toblerity RTree library:
import fiona
import rtree
with fiona.open(input_path,'r') as source:
p = rtree.index.Property()
p.filename = "index.idx"
p.overwrite = False
p.fill_factor=0.6 # some - absurd - values for tunning the index
p.get_pagesize=20 # another absurd value, for demo purposes
index = rtree.index.Index(properties=p) #create index
for f in source:
... # process features, add to index etc
I am, however, wondering, how to pass parameters to an index when calling the Geopandas sindex on a GeoDataFrame:
gpd.sindex
does not take any arguments.
The documentation states that all parameters from RTree are supported, but I am unsure how to pass them to the sindex.
sindexattribute returns an already created spatial index object (either anrtreeorpygeostree object), so currently you cannot control how it is created (i.e. you can't pass custom parameters to its constructor)sindexattribute.