Multiple origins multiple destinations

80 views
Skip to first unread message

kypriakos

unread,
Aug 19, 2011, 12:08:18 AM8/19/11
to Google Maps JavaScript API v3

Hi all,
I am using Maps v3 and Places for my app. I can get the origins of a
number of
peers and then I want to calculate the distances between them and a
number of
points of interest. What I am not sure about is whether is possible to
specify an array
of origins in the Map. Most likely I will need to iterate through the
origins and have
a callback with results for each origin to a set of destinations. Is
this the best way to
approach this?

Thanks very much in advance

function getPlaces() {

map = new google.maps.Map(document.getElementById('map'), {
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: peerLoc,
zoom: 15
});

var request = {
location: peerLoc,
radius: '1609',
types: ['grocery_or_supermarket']
};

infowindow = new google.maps.InfoWindow();
service = new google.maps.places.PlacesService(map);
service.search(request, callback2);
}

Esa

unread,
Aug 19, 2011, 11:31:15 AM8/19/11
to Google Maps JavaScript API v3

kypriakos

unread,
Aug 19, 2011, 2:09:46 PM8/19/11
to Google Maps JavaScript API v3

Hi Esa - yes I did thanks. But I was running into trouble when I was
using arrays of origins.
I think though I resolved it, first with callbacks and iterating over
the service calls and
second by finding that the array I was using was globally defined
elsewhere ;) Either way
i appreciate the response, it did help!

On Aug 19, 11:31 am, Esa <esa.ilm...@gmail.com> wrote:
> Have you studied Distance Matrix Servicehttp://code.google.com/apis/maps/documentation/javascript/reference.h...
Reply all
Reply to author
Forward
0 new messages