An open API service indexing awesome lists of open source software.

https://github.com/roy-corentin/r-tree

Implementation of R-Tree in Elixir
https://github.com/roy-corentin/r-tree

elixir rtree

Last synced: 12 months ago
JSON representation

Implementation of R-Tree in Elixir

Awesome Lists containing this project

README

          

* 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`:

#+begin_src elixir
def deps do
[
{:rtree, github: "roy-corentin/R-Tree"}
]
end
#+end_src

** Usage

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

#+begin_src elixir
# 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
#+end_src

** Documentation

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

** Contributing

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