300x250 AD TOP

Search This Blog

Pages

Paling Dilihat

Powered by Blogger.

Showing posts with label RTree. Show all posts
Showing posts with label RTree. Show all posts

Saturday, February 9, 2013

NuGet Package for RTree

I've just created a NuGet Package for the RTree porting I've done a few years ago, I've seen people are still interested in that project so why not make their lives easier?


I've also updated the project at (Just SVN):


I've added simple tests and changed the log4net dependency to NuGet.

I've also seen that Aled Morris updated his java documentation at:


Its not exactly the same anymore as the version I've ported is from 2009.





Tags:

Saturday, April 11, 2009

RTree

I had an idea for a geographic application not so long ago and I was looking for an algorithm to find all elements in a specific region (e.g. spatial index), finally I came upon an algorithm called RTree but I still couldn't find a C# code.


So I decided to port Java Spatial Index Library


You can find it here:
https://sourceforge.net/projects/cspatialindexrt/


Basic usage


Create a new instance:
RTree.RTree<T> tree = new RTree.RTree<T>();
            
Create a rectangle:
RTree.Rectangle rect = new RTree.Rectangle(1, 2, 3, 4, 5, 6);


Add a new rectangle to the RTree:
tree.Add(rect, object);


Check which objects are inside the rectangle:
var objects = tree.Contains(rect);


Count how many items in the RTree:
var i = tree.Count;


Check which objects intersect with the rectangle:
var objects = tree.Intersects(rect);


Create a point:
RTree.Point point = new RTree.Point(1, 2, 3);


Get a list of rectangles close to the point with maximum distance:
var objects = tree.Nearest(point, 10);




The library's code can be improved, but I needed something quick for a POC.
Tags: , ,