Kdtree subset query

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

Indentation off here.