Wed, 05/08/2019 - 07:48
#1
How to build a route trough the milttiple stops using the dieectionAPI and session ID
Hello guys. Could anybody help with my issue. How to build the route and add on it several stops(4..5 adresses through which the route should be created. And where I need tp added the adresses of stops if I have adresses represented as a city name and state. Also I have a session Id getted in response from direction api.
In the end I need the pic of the map with my route on it.
Hello hello, thx for your help. It's working, but the response is with wrong bounds which cut the route in some parts. It's impossible to look at all the route. And I see in the next your response that you have solved this problem somehow. I have looked at your request and I have a question. Can you describe this part of it plz??
boundingBox=39.801121,-105.225533,39.738453,-104.984856&size=838,657
what the coordinates? why it's three poitnts?? is it coordinates of the city??? and what the number of size???
@vladimir63 - thanks for having asked for this feature
@MQNickZustak - great job on this feature. Once I got the hang on using the route API (I was focused on static maps so far) getting the route to show on my map instead of the simple lines I was drawing so far took minutes. :) Please document this capability in the docs (https://developer.mapquest.com/documentation/static-map-api/v5/getting-started) - it's a shame it's hidden here in the forums.
I do have one request regarding the feature - while displaying proper routes on the map is great, I now lost the ability to customize the markers for each locations. Specifically - I would like to be able to use the numbered labels for all stops, including the first and last. I used to do that by specifying markers for each location - perhaps this could still be a valid api?
Thanks again for the feature and thanks in advance for your help,
Moshe
Regarding the docs - I now see that it was documented in the full API specification, just not in the getting started section: https://developer.mapquest.com/documentation/static-map-api/v5/map/
Regarding the stops - I will clarify that after playing around with my generated query, I find that the only problem I have is with the start and end markers, stops are not marked by default and were using my own markers, just not the start and end markers.
I also wanted to mention that perhaps the start / end parameters used for regular routes can be used to set these markers, if not have the location markers override the ones added for the route, as in the simple route examples:
https://www.mapquestapi.com/staticmap/v5/map?start=New+York,NY|flag-start&end=Washington,DC|flag-end&size=@2x&key=KEY
Not sure what the api would be (maybe just a marker name, without a location?)
Thanks in advance :)
Here is a sample pair of requests:
https://www.mapquestapi.com/directions/v2/route?key=******KEY******&from...
https://www.mapquestapi.com/staticmap/v5/map?key=******KEY******&size=50...|marker-sm-1||32.8298395,34.967313|marker-sm-2||32.8277742,34.9871949|marker-sm-3||32.8313908,34.9704919000001|marker-sm-4||32.8272398,34.9723179|marker-sm-5||32.8089933,34.9840361|marker-sm-6||32.8123726,34.9879039|marker-sm-7||32.8193413,34.9898846|marker-sm-8||32.063214,34.770737|marker-sm-9
In this case, I have a 9 step route that I'm trying to show with numbered markers, but the route's marker are given preferenece to the location markers, so the numbers 1 and 9 are not displayed.
Thanks again :)
Pasting urls in pre tags for convenience
https://www.mapquestapi.com/directions/v2/route?key=******KEY******&from=32.811534,35.0403303000001&to=32.8325048,34.9734172999999&to=32.8325048,34.9734172999999&to=32.8298395,34.967313&to=32.8298395,34.967313&to=32.8277742,34.9871949&to=32.8277742,34.9871949&to=32.8313908,34.9704919000001&to=32.8272398,34.9723179&to=32.8089933,34.9840361&to=32.8123726,34.9879039&to=32.8193413,34.9898846&to=32.063214,34.770737&doReverseGeocode=false&unit=k
https://www.mapquestapi.com/staticmap/v5/map?key=******KEY******&size=500,500&session=5d7223cc-01f2-4ee4-02b4-234a-0a030b1b6480&boundingBox=32.832382,34.770756,32.05941,35.046436&locations=32.8325048,34.9734172999999|marker-sm-1||32.8298395,34.967313|marker-sm-2||32.8277742,34.9871949|marker-sm-3||32.8313908,34.9704919000001|marker-sm-4||32.8272398,34.9723179|marker-sm-5||32.8089933,34.9840361|marker-sm-6||32.8123726,34.9879039|marker-sm-7||32.8193413,34.9898846|marker-sm-8||32.063214,34.770737|marker-sm-9