Method: RTree.csv_read

Defined in:
lib/rtree.rb

.csv_read(io_arg, dim, split: :quadratic, node_page: 0) ⇒ RTree

Note:

The CSV file (without header) should have the id in the first column, then twice as many floats as the dimension. Extra columns may be present and will be ignored (this useful feature is the reason that the dimension is a required argument).

Build a new RTree instance from CSV path or stream

Parameters:

  • io_arg (String|IO)

    a path or readable stream

  • dim (Integer)

    the dimension of the tree

  • split (:linear, :quadratic, :greene) (defaults to: :quadratic)
  • node_page (Integer) (defaults to: 0)

Returns:

  • (RTree)

    the newly built RTree



216
217
218
219
220
221
# File 'lib/rtree.rb', line 216

def csv_read(io_arg, dim, split: :quadratic, node_page: 0)
  flags = split_flag(split) | node_page_flag(node_page)
   RTree::IOUtil.io_with_mode(io_arg, 'r') do |io|
     super(io, dim, flags)
  end
end