Optimizing xy data selection with quadtrees