Skip to content

roy-corentin/R-Tree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rtree

Description

Rtree is an implementation of the R-Tree data structure in Elixir. R-Trees are used for indexing multi-dimensional information, such as geographical coordinates. This library provides a robust and efficient way to manage and query spatial data.

Installation

If available in Hex, the package can be installed by adding `rtree` to your list of dependencies in `mix.exs`:

def deps do
  [
    {:rtree, github: "roy-corentin/R-Tree"}
  ]
end

Usage

Here is a basic example of how to use the Rtree library:

# Create a new R-Tree node with a limit of 2 objects per node
node = %RNode{limit: 2}

# Insert objects into the R-Tree
node = RTree.insert(node, %RObject{x: 1, y: 1, data: "data1"})
node = RTree.insert(node, %RObject{x: 2, y: 2, data: "data2"})
node = RTree.insert(node, %RObject{x: 3, y: 3, data: "data3"})

# Search for an object in the R-Tree
case RTree.search(node, %{x: 2, y: 2}) do
  {:ok, object} -> IO.puts("Found object: #{inspect(object)}")
  {:error, "Not Found"} -> IO.puts("Object not found")
end

Documentation

Documentation can be generated with https://github.com/elixir-lang/ex_doc and published on https://hexdocs.pm. Once published, the docs can be found at https://hexdocs.pm/rtree.

Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

About

Implementation of R-Tree in Elixir

Topics

Resources

Stars

Watchers

Forks

Languages