I started a stackoverflow question on the issue:
http://stackoverflow.com/questions/27660298/store-2d-points-in-rtree-in-python

On Sat, Dec 27, 2014 at 4:23 PM, Juan Pablo Caram <jpca...@gmail.com> wrote:

> Hi,
>
> I'm having trouble deleting from an rtree index. In the script below I add
> 3 points and then try to delete them:
>
> from rtree import index as rtindex
> pts = [[0.0, 0.0], [0.0, 1.0], [1.0, 1.0]]
> rt = rtindex.Index()
> print rt.interleaved
>
> [rt.add(0, [x[0], x[1], x[0], x[1]]) for x in pts]
> print [x.bbox for x in list(rt.nearest([0, 0], 10, True))]
>
> for x in pts:
>     rt.delete(0, [x[0], x[1], x[0], x[1]])
>     print x, [x.bbox for x in list(rt.nearest([0, 0], 10, True))]
>
>
>
> And the result is:
>
> True
> [[0.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 1.0], [1.0, 1.0, 1.0, 1.0]]
> [0.0, 0.0] [[0.0, 1.0, 0.0, 1.0], [1.0, 1.0, 1.0, 1.0]]
> [0.0, 1.0] [[0.0, 1.0, 0.0, 1.0]]
> [1.0, 1.0] [[0.0, 1.0, 0.0, 1.0]]
>
>
> Basically, when trying to delete [0, 1] it's deleting the wrong thing. Is
> this a bug or am I using it wrong?
>
> Thanks,
>
> JP
>
>
_______________________________________________
Community mailing list
Community@lists.gispython.org
http://lists.gispython.org/mailman/listinfo/community

Reply via email to