This is a complex task to handle.
I’ve done this in the past with a java action by finding the points within a distance of a lat/long using binding coordinates as described here: http://janmatuschek.de/LatitudeLongitudeBoundingCoordinates
This could be a starting point as the java code that you’d need is available from that page.
Hope this helps.