path planning is done through Tencent official documents, which are written as follows
how to use:
- calculate the route plan from the beginning to the end through the route planning service.
We provide the corresponding route service products on the mobile side, the web side and the server side, [retrieve SDK] or [WebService API]; - presents the route to your users through [Map SDK] or [JavaScript API].
so I got the return value of path planning for walking, driving and public transportation through WebService API
for example:
{
"status":0, //
"message":"query ok", //
"result":{ //
"routes":[{ //
"mode":"WALKING", //
"distance":38385, //:
"duration":581, //:
"direction":"", //
"polyline":[39.915219, 116.403857,0,12,40,1180,40,1520,0,80,... ...],//
"steps":[
{ //,
"instruction":",239,",
"polyline_idx":[0,9], //0-9
"road_name":"", //()
"dir_desc":"", //
"distance":239, //:
"act_desc":"" //
},
... ...
{ //
"instruction":"255,",
"polyline_idx":[1556,1567],
"road_name":"",
"dir_desc":"",
"distance":255,
"act_desc":""
}
}
according to the instructions of the document, I need to draw the results on my map through JavaScript API, but I don"t know how to draw them, so I draw the route through the qq.maps.Polyline class. At the end of the WebService API document, it is said that if the starting point, the end point, and the passing point are not on the road, they will automatically adsorb to the nearby road
but my map does not adsorb to the road, indicating the straight link between the points. How can the thread be absorbed to a nearby road?