mourner / rbush

RBush — a high-performance JavaScript R-tree-based 2D spatial index for points and rectangles

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

search after load returns 0 points

biggerlambda opened this issue · comments

I did the following:

var arr = [[1,2],[3,4],[5,6]];
var rtree = new rbush(2);
rtree.load(arr);
var pts = rtree.search({minX:0,minY:0,maxX:10,maxY:10});

This returns 0 points. On investigating I find that this.data of rbush has minX,maxX etc set to NaN.

I did the following modification but got the same result;
. Using arrays of rectangles where minX and maxX were same eg..
var arr = [ {minX:1, minY:2, maxX:1, maxY:2} ....]
var rtree = new rbush(4);

found the problem