2015-10-16 87 views
1

我想問一下如何使用WinRT ComponentOne地圖在我的地圖上顯示路線。我無法顯示地圖並通過線路將點連接在一起,但線路並未遵循路線。ComponentOne WinRT在地圖上查找路線

enter image description here

它只顯示點之間的直線。有沒有人有一個想法如何解決這個問題?或者如果有任何其他選項如何解決這個在Windows 8.1應用程序,我將不勝感激。

感謝

+0

你已經提到 - 「我無法顯示地圖並按點連接點」。 您能夠顯示線條還是無法在地圖上顯示線條? – AbdiasM

回答

1

由於Component One使用Bing映射,因此您可以更輕鬆地使用其REST API。

首先,你需要在這裏得到Bing地圖鍵:https://www.bingmapsportal.comhttps://msdn.microsoft.com/en-us/library/ff701717.aspx參考頁獲得相應的查詢網址,您的問題。此頁面上還有其他可選參數的詳細信息。 然後只需使用WebRequest來調用此URL並在回覆中即可獲得Bing地圖API的響應。

WebRequest wc = HttpWebRequest.Create(uri); 
try { 
    using (HttpWebResponse response = await wc.GetResponseAsync() as HttpWebResponse){ 
     DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(BingMapsRESTService.Common.JSON.Response)); 
     return ser.ReadObject(response.GetResponseStream()) as BingMapsRESTService.Common.JSON.Response; 
    } 
} 
catch(Exception ex){ 
    return null; 
} 

有關此響應的更多信息,請參閱https://msdn.microsoft.com/en-us/library/mt270292.aspx