http://www.perlmonks.org?node_id=884077


in reply to Lookup closest hash key

Steffen Müller has been working on Algorithm::SpatialIndex, which creates (for example) a quadtree, a structure that can easily tell you what rectangle a point falls in. I'm not sure whether you can massage your data to cover the area with rectangles, but maybe that works or works well enough. Alternatively, maybe one of the Voronoi modules helps you to create the areas where a point is "nearest".