updated spatial Rtree code