Google Maps API - matching a request with the asynchronous response

143 Views Asked by At

I'm using the google maps distance matrix javascript API to query the travel time from one point to about 50 destinations. in order to do this, I need to break my query up into multiple chunks, since the google maps API allows only a maximum of 25 destinations per request.

the problem that I'm having is the synchronization of the request and the result. other APIs offer the option to include a key that lets the developer match a request and an asynchronous result. however, since such a parameter is missing from the request specification, I have no idea how to make sure that I'm matching the right data to my incoming results.

I would be glad for a "clean" workaround - currently the only idea that I'm having is to have a unique number of destinations for each request, for instance the first with 25, the next with 24 destinations and so on. but I would not consider this a satisfactory approach. thank you

0

There are 0 best solutions below