On Oct 23, 2012, at 10:59 PM, Redoute <[email protected]> wrote:
> Hello all, > > in some Python scripts I want to query an rtree index like this: > > for member in ix.nearest(point, <infinite>): > if check(member): break > > Setting num_results to high numbers gets expensive with a large index. > Do you have general advice how to deal with this? > > Could nearest() (and maybe intersection() too) be modified, so that the > work is delayed into the generator to allow "open end" queries? Redoute, This is not currently possible, and it would take some updates to the C API of libspatialindex to support it. In short, the C API constructs an array for all of the results in memory before handing it back to the client (in this case Python). The base libspatialindex library itself absolutely supports this through it its visitor pattern, however. Presumably there would need to be some sort of callback-based method, much like the way the DataStream stuff in the C API works in the reverse direction, to connect up the Python side to the results visitor. I'm not sure this helps you too much, but if you're looking to go deep, the direction I have described is probably the way to start trekking. Howard http://hobu.biz http://pointcloud.org _______________________________________________ Community mailing list [email protected] http://lists.gispython.org/mailman/listinfo/community
