Kdtree subset query

@rgommers 
#4260 was merged despite not having any commits inside... So I am reissuing a PR

I think (?) this is part of the public API, so this would be a backwards compat break.