Route Matrix single-line-request with many locations?

4 posts / 0 new
Last post
JacquesFast
Route Matrix single-line-request with many locations?

Hi. I'm trying to get distances between various locations. So far I've managed to get the distance between 2 location by doing something like that:

"http://www.mapquestapi.com/directions/v2/routematrix?key=[...]&ambiguiti..."

Now I'd like to use manyToOne in order to get many distances at once. The documentation says manyToOne "[...] will compute time and distance from many origins to a single destination (the first location in lc)." But what is the exact syntax? I tried something like that:

"http://www.mapquestapi.com/directions/v2/routematrix?key=[...]&ambiguiti..."

But I get "The LocationCollection must contain at least two locations", so maybe I'm just missing the correct list separator? Thanks for your ideas!

 


MQBrianCoakley
There is a mix of key value
There is a mix of key value pairs and json input in the second request. The api requires one or the other rather than both. Here are a couple versions that should work. The addresses look like they need to be better defined though. http://www.mapquestapi.com/directions/v2/routematrix?key=[...]&ambiguiti... orhttp://www.mapquestapi.com/directions/v2/routematrix?key=[...]&ambiguiti...{options:{routeType:"fastest",unit:"k",allToAll:"false",manyToOne:"true"},locations:["Prag%201%20Tschechien","01067%20Dresden","90471%20Nuernbergs","48143%20Muenster"]}  

JacquesFast
seems to work!

A first test looks like this works - thank you MQBrianCoakley for the quick reply! And yes, I'll have a closer look at the actual addresses...


MQBrianCoakley
You're welcome!
You're welcome!