How to calculate the driving distance between two locations based on Baidu map (two languages: js and C #),
The following code uses JavaScript code to calculate the distance between two locations on Baidu map:
<Script src = "js/jquery-1.9.0.js" type = "text/javascript" language = "javascript"> </script> <script language = "javascript" type = "text/javascript" src = "js/area. js "> </script> <script type =" text/javascript "src =" http://www.bkjia.com/uploads/allimg/151031/0010432G5-0.gif "alt =" Chinese highway mileage query "width =" 81 "height =" 26 "style = "vertical-align: middle; "/> </div> </td> <table width =" 380 "border =" 0 "cellspacing =" 0 "cellp Adding = "0"> <tr> <td width = "50"> </td> <td width = "19"> <span style = "padding-top: 2px; "> </span> </td> <td width =" 90 "style =" font-size: 12px; "> departure city </td> <input name =" farea "type =" text "id =" farea "size =" 10 "/> </td> <td width = "26" align = "center" style = "font-size: 12px; "> to </td> <td width =" 110 "> <input name =" tarea "type =" text "id =" tarea "size =" 10 "/> </td> <div onclick = "SetMap2 (); return false; "Style =" cursor: pointer; width: 81px; "> </div> </td> </tr> </table> </div> </td> </tr> <td> <div style = "border: # cccccc 1px solid; padding: 5px; "> </div> </td> </tr> <td valign =" top "> <div style = "float: left; width: 670px; vertical-align: top; "> <div Style = "height: 500px; border: 1px solid gray" id = "container"> </div> <div style = "float: right; width: 300px; vertical-align: top; "> <div style =" border: # cccccc 1px solid; "> <div class =" content_title "style =" color: Red; background-image: url (); border-bottom: solid 1px # ccc; height: 30px; text-align: center; font-weight: bold; line-height: 30px; "id =" div_title "> query result </div> <div id =" div_gongli "style = "Color: #336600; font-weight: bold; padding-left: 5px; line-height: 35px; font-size: 14px; "> </div> <div id =" results "style =" font-size: 12px; "> </div> </td> </tr> </table> </ div> </body>
The following describes how C # calculates the driving distance between two locations based on Baidu map.
<Html>