Latest Updates
Greenwich Bug Fixed
There was a bug in the neighboursWithinRadius function - it was not working correctly if the circle crossed the Greenwich Meridian. That should be fixed now, and available on github.
Welcome Hacker News Folks!
If you're coming from hacker news because you're
curious about the site, you should probably head over to the
FAQ to get the gist, and then to the
google maps demo to see
how it all fits together.
Radius Searching
Today I added something to the JS library that's pretty cool: given a GeoDNA code and a radius, it generates the minimal covering set of all GeoDNA codes required to represent that radius. In terms of real-world applications, this is useful because you often want to perform radius-based searching centred on a specific point.
For example, if you wanted to perform a proximity search of your data to find all records within 40km of "wtaatcagtca" (Cuzco, Peru), then you call
var neighbours = GeoDNA.neighboursWithinRadius( "wtaatcagtca", 40, { precision: 11 } );
["wtaatcagcta", "wtaatcagcgt", "wtaatcagctg", "wtaatcagctt",
"wtaatcagtac", "wtaatcagtca", "wtaatcagtcc", "wtaatcatgaa",
"wtaatcagtat", "wtaatcagtcg", "wtaatcagtct", "wtaatcagtta"]
you will get back a set of codes, often of different sizes (but never smaller than precision 11), that entirely cover the circle of radius 40km around Cuzco.
You can then find any records in that area by simply locating all your records whose GeoDNA starts with any of those codes. Text-based prefix searching is usually extremely fast.
Check out the google maps demo to see the system generate these covering codes.