Skip to content

marchello2000/RTree

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RTree

C# RTree implementation

Build status

Forked from https://github.com/enyim/RTree to fix bugs and add a nuget package
C# port based on this JavaScript implementation by Vladimir Agafonkin.

RTree is a very fast spatial data structure and index.

Usage

using Enyim.Collections;

RTree<Line> rtree = new RTree<Line>();

// Bulk insertion (2-3x faster than 1 by 1 insertion)
List<RTreeNode<Line>> nodes = new List<RTreeNode<Line>>();
Line l = new Line(0, 0, 10, 10);
nodes.Add(new RTreeNode<Line>(
    l, 
    new Envelope((int)Math.Min(l.X1, l.X2), (int)Math.Min(l.Y1, l.Y2), (int)Math.Max(l.X1, l.X2), (int)Math.Max(l.Y1, l.Y2))
    ));

rtree.Load(nodes);

// One-off insertion
rtree.Insert(l, new Envelope(...));

// Search
var results = rtree.Search(new Envelope(0, 0, 1, 1));

foreach (var result in results)
{
    Line l = result.Data;
    ...
}

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%