githubsrinath / geomodel

Automatically exported from code.google.com/p/geomodel
0 stars 0 forks source link

If locations of many models are the same, duplicates are possible in in proximity_fetch #18

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a database where you have many nodes with the same lat lon, and 
proximity_fetch can 
end up returning dupes due to a bug in _merge_results_in_place because ordering 
becomes 
arbitrary.

FIX: 

    def _merge_results_in_place(a, b):
        def my_cmp_fn(x,y):
            result = cmp(x[1],y[1])
            if result == 0:
                return cmp(x[0].key(),y[0].key())
            return result

      util.merge_in_place(a, b,
                        cmp_fn=my_cmp_fn,
                        dup_fn=lambda x, y: x[0].key() == y[0].key())

Original issue reported on code.google.com by ericsilv...@gmail.com on 27 May 2010 at 3:14