I am working with C# WebClient and the UriBuilder class, communicating with the Google Distance Matrix API. My program is sending comma-separated latitude,longitude pairs. Things are working properly with one origin and multiple destinations: the destinations values on the query string simply need to be delimited with the bar character, "|":
&destinations=latitude1,longitude1|latitude2,longitude2...
But I would like to get it working with multiple origins, where each origin has its own multiple destinations. Is that possible? Or does the API produce a cartesian product, computing distances for every origin against every destination?
If it is possible, how to coordinate origins[i]
with destinations[i]
on the query string?
Here's an example structure in my C# program (geo-locations obscured):
I need to translate that structure into a format the API would accept on the query string, in a manner that links destinationArray[0]
with origin[0]
and destinationArray[1]
with origin[1]
.