C# Windows UWP 在路线中使用人行道

C# Windows UWP Use Sidewalk in Routes

我想创建一个显示步行路线的应用程序 GetWalkingRouteFromWaypointsAsync(); 方法。 这对我来说很好,但我无法使用显示在 Bing 地图上的人行道。该方法不使用它们。 有没有办法在我的应用程序中使用它们?

MapRouteFinderResult routeResult =
  await MapRouteFinder.GetWalkingRouteFromWaypointsAsync(waypoints);
  if (routeResult.Status == MapRouteFinderStatus.Success)
  {
    // Use the route to initialize a MapRouteView.
    MapRouteView viewOfRoute = new MapRouteView(routeResult.Route);
    viewOfRoute.RouteColor = Colors.Yellow;
    viewOfRoute.OutlineColor = Colors.Black;
    double dis = routeResult.Route.LengthInMeters / 1000;
    distance.Text = dis.ToString() + " km";
    // Add the new MapRouteView to the Routes collection
    // of the MapControl.
    RouteMap.Routes.Add(viewOfRoute);

    // Fit the MapControl to the route.
    await RouteMap.TrySetViewBoundsAsync(
          routeResult.Route.BoundingBox, null,
          Windows.UI.Xaml.Controls.Maps.MapAnimationKind.None);
  }

来自MSDN您必须指定地图身份验证密钥才能使用地图服务。有关详细信息,请参阅请求地图身份验证密钥。

这是出于安全原因,因此您必须对您的通用 windows 应用程序进行身份验证。

如果您想在您的应用中指定身份验证密钥:Click here

现在,我知道如何解决这个问题了。 如果没有足够的waypoints你不能使用人行道并且路线将在街道附近生成,但是如果在人行道上行走时有更多的点它有效。