-6

I need to group addresses given their distances. Let's say I have a list of 8 addresses. 5 in NYC and 3 in New Jersey. From those 5 in NYC 3 are close to the MET and 2 to the WTC. Those 3 in NJ would form one group, those close to the MET another and also those close to the WTC.

I 'd like to send this address list and get the closest to each other, grouped. Is there any API from Google Maps or Bing Maps that would do that? If not, would you have any suggestions on how to solve this?

At the question below lots of ways to calculate distance are mentioned, but I wonder if is there something already created (and available) from these big companies. I wouldn't like to recalculate every address in the list every time a new one is added.

How to group latitude/longitude points that are 'close' to each other?

Also, there's another problem that was not addressed at the aforementioned question... One address can be close to a group and several other groups. For instance:

enter image description here

In this example I've highlighted at least 4 groups. B forms one "close group" with A/C, but also with C/F, A/E/G and E/F/D/H. So I'd also like to know those variables. To which group the address is closer, or at least I though about limiting groups by the amount of members. In my example, using my suggested approach, B would be part of either the RED or BLACK group.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
eestein
  • 4,914
  • 8
  • 54
  • 93
  • http://en.wikipedia.org/wiki/Cluster_analysis – AakashM May 15 '15 at 14:04
  • 2
    This question is rather broad. If you're looking for an algorithm to be implemented maybe programmers.se is open for this question but check their meta and help first. – rene May 18 '15 at 14:09
  • @rene Thanks, but I disagree. The question seems to be pretty specific to me (of course). I have a specific problem (grouping close addresses) that I don't know the answer for. And I even got some nice suggestions here, like the cluster analysis and the friend that removed his answer. – eestein May 18 '15 at 14:18
  • Sure, I only try to give you an explanation for the downvotes, as requested by you on meta. – rene May 18 '15 at 14:44
  • @rene I understand and I respect your viewpoint. But I don't think it's broad. I appreciate your time, though. – eestein May 18 '15 at 14:46
  • @Phpdevpad it's fine. When I'm able to get the software working I'll update with the results. :) – eestein May 18 '15 at 18:46
  • For StackOverflow, this question is broad. This is because the question is conceptual. It does not seem to elicit specific programming answers. You did not even specify a programming language. I agree that it would probably be better on [Programmers](http://programmers.stackexchange.com/) or perhaps [CS](http://cs.stackexchange.com/). – SunSparc May 20 '15 at 17:12

1 Answers1

1

You can try a quadkey and exploit it visit nearby points firstly, similar to a space filling curve. Treat the points as a binary and interleave it. Treat the index as base-4 number. Then sort the numbers.

Micromega
  • 12,486
  • 7
  • 35
  • 72
  • Hey, thanks for your answer. Could elaborate a little bit more? What do you mean by: "Treat the points as a binary and interleave it." you lost me there. Thanks again. – eestein May 18 '15 at 12:55
  • Convert the coordinate to a binary and interleave it. Usually a binary of a number is something quadratique!? – Micromega May 18 '15 at 13:04
  • Alright! thanks for that. I'll add that to my studies. I'll update this thread with my solution, as soon as I solve it :) Thanks! – eestein May 18 '15 at 13:23