added the within distance routines (without need of a spatial db)