ComponentOne WinRT在地图上查找路线

时间:2015-10-16 11:03:50

标签: c# winrt-xaml windows-rt componentone

我想问一下如何使用WinRT ComponentOne地图在我的地图上显示路线。我无法显示地图并按行连接点,但行不遵循路线。

enter image description here

它只显示了点之间的直线。有人知道如何解决这个问题吗?或者,如果在Windows 8.1应用程序中有任何其他选项如何解决此问题,我将不胜感激。

由于

3 个答案:

答案 0 :(得分:1)

您的查询已在以下链接中得到解答,请参阅以下链接:

http://our.componentone.com/groups/topic/winrt-finding-route-on-map/#post-671809

答案 1 :(得分:1)

由于Component One使用Bing地图,因此您可以更轻松地使用其REST API。

首先,您需要在此处获取Bing地图密钥:https://www.bingmapsportal.com 在参考页面https://msdn.microsoft.com/en-us/library/ff701717.aspx上获取相应的查询URL以解决您的问题。在此页面上还有其他可选参数的详细信息。 然后只需使用WebRequest来调用此URL,作为回复,您将收到来自Bing maps 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

答案 2 :(得分:0)

您可以使用C1VectorPolyline类并在其Points集合中添加点来在C1Map上绘制路径。您可以在以下文档链接中找到相关教程:http://helpcentral.componentone.com/nethelp/mapswinrt/Marking%20a%20Route%20with%20a%20C1VectorPolyline.html