Git Product home page Git Product logo

rtreego's People

Contributors

abductcows avatar cbergoon avatar charlievieth avatar ctessum avatar db7 avatar dhconnelly avatar fumin avatar kuznetsovin avatar magnushiie avatar mertakman avatar minkezhang avatar samihiltunen avatar tsne avatar yilinjuang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rtreego's Issues

Invalid data in tree after Inserting

I think there is a bug.
I tried bulk load, then deleting every 2nd element, and inserting back all elements deleted.
After that there are several copies of some elements and some are missing.
https://gist.github.com/codpe/c4b9ad39b91e4a79ab4647432b01bcca

I managed to find out, that this append sometimes changes entities in at least 2 nodes.

leaf.entries = append(leaf.entries, e)

I think it is somehow connected with the thing that several slices can point to same array

Why you only do slice on top level?

Hi, I noticed that in the r-tree implementation where in file "rtree.go", you only do the slicing at the root level, the other levels use just one slice whose length is the size of entire current subdataset (i.e. don't slice).

May i ask why you are doing this?

From what I have observed, if the slicing strategy is used in every height of recursion, it is possible to generate better leaf MBRs (their length and width are closer rather than one being much larger than the other).

Polygon implementation

is this support polygon (add, indexing and query) and spatial operation like within, intersect?

Invalid tree after delete

If condenseTree reduces the depth of the tree, the height variable does not get updated. If fact, height never decreases. It is only modified by increment, when a split occurs at the root. The result is that, by deleting noes, the tree may become invalid.

PR #11 overwrites the tree height with the root node level after deleting nodes. It also includes a simple test case that fails without the fix.

Encode/Decode using gob.

Hello I am using your library in one of the projects and it would be nice if you can help me out with using gob package to pack/unpack RTree.

We parse a lot of data from XML to RTree and this data is not changing after server start.
Good way will be to load it back from file (using gob encode/decode).

Thank you.

No Recent Tag

I noticed master is considerably ahead of the last tag. Is there a reason it hasn't recently been tagged and released?

Filters should stop looping as soon as first refuses entry

Currently, when one is performing a search with filters, the ApplyFilters function will execute every single filter even though some of them might already have refused the item. If the loop would stop as soon as the first filter refuses the item, one can achieve great performance improvements by placing the most expensive filters at the end of the list of filters. So I'd suggest breaking the loop on the first refuse or abort.

Add bounding box for points

Seem quite weird to me that there is no way to take two points and create rect. I would expect to be able to create bounding box taking 2+ points and creating Rect based on min and max lng/lat/..(x/y/..) values.

I see there is private function for this, why not make it public?

Why not R* ?

hi ,
Would you consider upgrading the Rtree to R*tree?

Points vs Spatial

I want to use NearestNeighbor() to find the closest Points, but this isn't supported. Is this something that could be added? Or could I just use 1x1x1 Spatials to approximate this?

Picking numbers for Min/MaxChildren

Firstly, thanks for the library, really helpful.

I'm dealing with a set of documents that ranges from 10 points to 100,000 points. Each document has its own rtree and I'd be interested in "intelligently" picking the min/max children for each tree I generate.

Could you offer some advice about how I should go about picking appropriate min/max children?

thanks!

Bulk-loading results in invalid trees

Often, bulk-loading a tree results in trees with more children than MaxChildren and more levels than returned by Rtree.Depth(). The searches seem to be unaffected, but that may cause issues when inserting or deleting entries after bulk load.

There are several issues in the OMT bulk-load implementation that cause the invalid trees:

  • the calculated height by the algorithm does not match the depth reached during recursion
  • the splitting of vertical slices results in not fully packed leaves
  • the same problem results in non-leaf nodes containing more children than MaxChildren

We found this problem while trying to reduce the allocations in the KNN search, see issue #24.

NewRectFromPoints should not modify its inputs

NewRectFromPoints currently modifies its input slices without any warning in the documentation to the caller.

This can result in hours of troubleshooting, as it only happens if some first coordinate is above the second coordinate.

Also consider using value types (arrays) instead of reference types (slices).

will you implement R*tree?

R*Tree has better query performance.

I'm going to use RTree to do multi-dimension information query, instead of for spatial searching, for example, to query records witch satisfies [type, age, score... etc... ], I think rtree fits well for this situation.

not work when dim = 3

rtreego.NewTree(3, 32, 64)},
find nearest point should be : lat 30.36424936824087, lon 104.03521157476646 ele 413.5494622178376๏ผŒ
but it is : Loc:[30.36001598001311 104.04658807033596 413.5494622178376]

Concurrent Splits Crash With Duplicate Inserts

I've been working with (a fork of) Patrick Higgins' fork of this package, but this same code exists in all three forks so I figured I should make note of this crash I've been seeing.

When inserting several Spatials at the same time at the same location and dimensions, this piece of code can break, as split tries to use indices to split with that are no longer valid, as it reset the entries in n.


func (n *node) split(minGroupSize int) (left, right *node) {
	// find the initial split
	l, r := n.pickSeeds()

	leftSeed, rightSeed := n.entries[l], n.entries[r]  <---- Crash here, index out of range, 2nd goroutine

	// get the entries to be divided between left and right
	remaining := append(n.entries[:l], n.entries[l+1:r]...)
	remaining = append(remaining, n.entries[r+1:]...)

	// setup the new split nodes, but re-use n as the left node
	left = n
	left.entries = []entry{leftSeed} <----- reset n's entries here, 1st goroutine
        ...

This can also show up sooner, here, when pickSeeds tries to range over entries[i+1:].

I don't think this is worth fixing, but I figured it was worth documenting. I just changed how the calling code worked so it wouldn't add duplicates.

NearestNeighbors perform too many allocations, GC stalls

When continuously running KNN-searches, we have noticed that sometimes the garbage collector (Go >= 1.9) stalls the process for more than 2s. That caused often deadline exceeded errors in our search services.

The issue occurs when sorting the nodes of each level: KNN goes depth first and at each node sorts its children in a temporary buffer of size <= MaxChildren. KNN then prunes some of the children and continues descending the tree in the recursion up to Rtree.Depth() levels. When the recursion returns and advances to siblings, more buffers are allocated down to the leaf nodes. That causes too many allocations for large trees and generate excessive trash for the garbage collector.

Instead of allocating a buffer for each node to sort its children, one can allocate one single buffer at the root and slide over the buffer the deeper one goes. The buffer should have the size MaxChildren*Rtree.Depth().

Ouput an image for debugging

We are using your project in a non-graphical context and we are still in the developement phase. For the sake of debugging we would like to know the current state of the rtree.

Many libraries for Quadtree can ouput a PNG with all the points and regions.

There is a String method but it only returns "foo" instead of a string representation of the rtree.

NearestNeighbors not returning correct point

Hi,

Thanks for this awesome lib.
I am facing an issue :
I have following points:
keysBody := []byte([{"id": "1","name": "A","location": [88.495873,22.551802]},{"id": "2","name": "B","location": [88.490197,22.552743]},{"id": "3","name": "C","location": [88.492724,22.558270]}])
.................
type Storage struct {
Users map[string][]*user
geoIndex *rtreego.Rtree
nearestNeighbors int
}
.............
geoIndex.Insert(user)
............
lat := 22.562454
lon := 88.494374
...
geoIndex.NearestNeighbors(
20, rtreego.Point{lat, lon},
)

It always return : {"id": "2","name": "B","location": [88.490197,22.552743]} while id 3 (name c) is nearest

am I doing wrong or something ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.