0

I am working on any optimal vehicle routing problem. I want to start map routing on the road starting from one city A to city B to City C to city D back to city A

Based on lat/lng of these cities

I have the cities already worked out just want to display it on map-quest map?

This is sound as it is fundamental what mapping solution will offer out of the box but I am had googled this for days now with no particular solution

Can somebody point out the right direction to go?

I am using MapQuest.

4
0

Well for me it is not clear what you want to achieve exactly. Here are two options. The first one will get you your routing information as a json or xml (see mapquest api docs) to do further processing. The second option is just an Example to show your routing using the mapQuest/directions api in a hacky way.

This will get you a json response with your routing information:

from RouteOptions import RouteOptions
from RouteService import RouteService

options = RouteOptions()
service = RouteService('YOUR_MAPQUEST_DEVELOPER_API_KEY')

multi_location_list = ['Lancaster, PA', 'State College, PA', 'York, PA']
multiDirRoute = service.directions(locations=multi_location_list, options=options)

More information can be found here: https://github.com/MapQuest/directions-api-python-client https://developer.mapquest.com/documentation/directions-api/

If you want to see your route with https://mapQuest.com/directions you could hack yourself the url string and open it with the browser.

Example string:

https://www.mapquest.com/directions/from/near-33.94,-118.13/to/us/il/chicago/to/us/dc/washington/to/us/ny/new-york

So you could insert the coordinates .../from/near...,..../to/near...,.../to/near...,...

This will open your browser and display the route.

import webbrowser

website = "https://www.mapquest.com/directions/from/near-33.94,-118.13/to/us/il/chicago/to/us/dc/washington/to/us/ny/new-york"
webbrowser.open_new(website)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.