algorithm - How to group close addresses? -


i need group addresses given distances. let's have list of 8 addresses. 5 in nyc , 3 in new jersey. 5 in nyc 3 close met , 2 wtc. 3 in nj form 1 group, close met , close wtc.

i 'd send address list , closest each other, grouped. there api google maps or bing maps that? if not, have suggestions on how solve this?

at question below lots of ways calculate distance mentioned, wonder if there created (and available) these big companies. wouldn't recalculate every address in list every time new 1 added.

how group latitude/longitude points 'close' each other?

also, there's problem not addressed @ aforementioned question... 1 address can close group , several other groups. instance:

enter image description here

in example i've highlighted @ least 4 groups. b forms 1 "close group" a/c, c/f, a/e/g , e/f/d/h. i'd know variables. group address closer, or @ least though limiting groups amount of members. in example, using suggested approach, b part of either red or black group.

edit: whoever downvoted question, care explain why? improved? not easy understand? thank you.

you can try quadkey , exploit visit nearby points firstly, similar space filling curve. treat points binary , interleave it. treat index base-4 number. sort numbers.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -