I am beginner with the RTree I use libspatialindex, I will want to know how I insert a polygon / point with a measurement (statistic or measurement of weather) do I have to change the structure ?

from rtree import index

idx = index.Index()
idx.insert(0, (0, 0, 1,1 ),my mesure)

yet I see in the class Node the attribute byte** m_pData; (it is he who contains the information of each leaf)

1 Answer 1


I suspect you're reading the libspatialite documentation. Libspatialite is written in C++.

Your code uses RTree. This is a Python library, which uses Libspatialite.

See using rtree as a cheapo spatial database.

Anything which can be 'pickled' can be used as the last parameter.

For example, you could pass a simple value

index.insert(id=id, bounds=(left, bottom, right, top), obj=42)

or something more detailed...

index.insert(id=id, bounds=(left, bottom, right, top), obj={'average':42,'count':12,'type':'awesome'})

RTree will take your python objects and convert them into the objects needed by Libspatialite.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.