rtree-csv — rectangle CSV format for librtree


The rtree_csv_read function reads files in the CSV format in order to build an R-tree (as discussed in rtree(3) ).

The format is plain text, a quite standard CSV file with no header. Each line corresponds to an input rectangle (cuboid, hyper-rectangle) and the fields are

  • An unsigned integer, the id of the rectangle. Typically this will be used to index the application data corresponding to this rectangle, but this is entirely at the discretion of the caller, the library itself makes no use of the value which it treats as a payload. In particular, it need not be unique (and may be zero).

  • Twice as many floating point values as the dimension of the rectangles. These are interpreted as the extent of the rectangles: the lower values of each dimension, followed by the upper values of each dimension.

  • As many other values as desired, these will be ignored.


The following example is taken from the library's test-suite, four two-dimensional rectangles:

0, 0.374540, 0.598658, 0.950714, 0.731994
1, 0.155995, 0.058084, 0.156019, 0.866176
2, 0.601115, 0.020584, 0.708073, 0.969910
3, 0.212339, 0.181825, 0.832443, 0.183405


J. J. Green, .


rtree(3) , rtree-build(1) .