-2

I have a list of locations "A" and a list of users "B" that I need to generate a List from "C".

I need to be able to see which users in B are within say 1/4 mile of the locations in list "A" and dump that into a readable list (not a map).

Is there a relatively easy way to do this with the google-maps-api or am I barking up the wrong tree?

By the way all of the lists are static. Locations on "A" and "B' never change.

Sample info: "A" Holmes Detective Agency , 401 E South St, Jackson MS 39201 "B" John Watson, 400 high st, Jackson MS 39201

1 Answers1

-1

Use the DistanceMatrix API

origins      = Locations list A
destinations = Users list  B

You will have a response with something like this:

{
   "destination_addresses" : [
      "user-1 address",
      "user-2 address"
   ],
   "origin_addresses" : [ 
      "location-1",
      "location-2"
   ],

   "rows" : [
      {
         "elements" : [
            {
               "distance" : {
                  "text" : "4.2 km",
                  "value" : 4247
               },
               "duration" : {
                  "text" : "16 mins",
                  "value" : 968
               },
               "status" : "OK"
            },
            {
               "distance" : {
                  "text" : "11.7 km",
                  "value" : 11670
               },
               "duration" : {
                  "text" : "31 mins",
                  "value" : 1851
               },
               "status" : "OK"
            }
         ]
      }
   ],
   "status" : "OK"
}

Loop through the API response and compare distance < x mile and you will have your result.

MrUpsidown
  • 21,592
  • 15
  • 77
  • 131
krishnar
  • 2,537
  • 9
  • 23