0
我想在我的Windows窗體在C#中使用GMaps。我已經創建了確切的路線,但有什麼方法可以計算GMaps.NET中的路線距離和持續時間,除了調用Google Distance Matrix Api之外,還有其他功能可以實現嗎?GMap.NET C#,距離2點沒有谷歌距離矩陣Api
我想在我的Windows窗體在C#中使用GMaps。我已經創建了確切的路線,但有什麼方法可以計算GMaps.NET中的路線距離和持續時間,除了調用Google Distance Matrix Api之外,還有其他功能可以實現嗎?GMap.NET C#,距離2點沒有谷歌距離矩陣Api
我在找的函數名爲「距離」。 這是如何獲得路線的距離:
inicial = new PointLatLng(googleGeoCoding(txtorigin.Text).Item2,googleGeoCoding(txtorigin.Text).Item3);
final = new PointLatLng(googleGeoCoding(txtdest.Text).Item2, googleGeoCoding(txtdest.Text).Item3);
GDirections routedir;
var routefromtable = GMapProviders.GoogleMap.GetDirections(out routedir, inicial, final, chbxhighways.Checked, chbxtolls.Checked, rbtnwalking.Checked, false, false);
GMapRoute tablemaproute = new GMapRoute(routedir.Route, "Ruta ubication");
GMapOverlay tablerouteoverlay = new GMapOverlay("Capa de la ruta");
tablerouteoverlay.Routes.Add(tablemaproute);
gMapControl1.Overlays.Add(tablerouteoverlay);
gMapControl1.Zoom = gMapControl1.Zoom + 1;
gMapControl1.Zoom = gMapControl1.Zoom - 1;
double distance = tablemaproute.Distance;
MessageBox.Show(distance.ToString());