I'm using the MapQuest
directions API for one of my projects and drawing the result with MapBox
(I have to use both because MapQuest
has options that MapBox
doesn't have), but it seems that it returns too few points to draw an accurate route.
As you can see, instead of following the streets, it draws a straight line between waypoints.
I've unsuccessfully tried to use the fullShape
, generalize
and mapState
options (all of these options seemed to have no effect on the number of points returned).
Here is my API call :
https://www.mapquestapi.com/directions/v2/route?key=[myKey]&from=48.89333%2C+2.28778&to=48.833%2C+2.385684&outFormat=json&avoids=Tunnel&fullShape=false&generalize=0&tryAvoidLinkIds=79525010,71821176
Am I using these options incorrectly, or are there any other way to have more points in the returned data ?
Thanks you for your replies.
You have to set parameter generalize to 1 to get a better shape.
In the documentation,
Generalize : If the generalize parameter is > 0, it will be used as the tolerance distance (in meters) in the Douglas-Peucker Algorithm for line simplification. (API Mapquest Documentation)
You will have a shapePoints array like that :
And you can plug it in Mapbox!
Let me know if it works for you ;-)