如何计算起始坐标和结束坐标之间的坐标 - uwp c#
How to calculate coordinates between the start coordinate and the end coordinate - uwp c#
在 My Map Control 中,我想通过给定的公交车站移动公交车。为此,我已经通过给定的站点绘制了路线。现在我想通过这条路线移动公共汽车。为了通过路径更平滑地渲染公交车,我必须在起始坐标和结束坐标之间找到多个位置。这些地方应该有公路运输。我怎样才能实现它?
这是四站。
Geopath path = new Geopath(new List<BasicGeoposition>(){
new BasicGeoposition()
{
Latitude= 1.2989658333333334, Longitude=103.8004543333333
} ,
new BasicGeoposition()
{
Latitude=1.3027026666666668, Longitude=103.80124616666667
} ,
new BasicGeoposition()
{
Latitude=1.3062241666666665, Longitude=103.80175516666667
} ,
new BasicGeoposition()
{
Latitude=1.3087055, Longitude=103.8026675
}
}
);
您可以使用:
MapRouteFinder.GetDrivingRouteAsync(Geopoint, Geopoint)
传入开始和结束位置,它 returns 一个 MapRouteFinderResult 对象。
BasicGeoposition startLocation = new BasicGeoposition() {Latitude=47.643,Longitude=-122.131};
// End at the city of Seattle, Washington.
BasicGeoposition endLocation = new BasicGeoposition() {Latitude = 47.604,Longitude= -122.329};
// Get the route between the points.
MapRouteFinderResult routeResult =
await MapRouteFinder.GetDrivingRouteAsync(
new Geopoint(startLocation),
new Geopoint(endLocation),
MapRouteOptimization.Time,
MapRouteRestrictions.None);
- MapRouteFinderResult 有一个 'Route' 属性 类型的 MapRoute。
- MapRoute 有一个 'Path' 属性 类型的 GeoPath。
- GeoPath 有一个 IReadOnlyList 类型的“位置”属性,它可以为您提供坐标。
完整的例子可以在这里找到:
https://docs.microsoft.com/nl-nl/windows/uwp/maps-and-location/routes-and-directions
在 My Map Control 中,我想通过给定的公交车站移动公交车。为此,我已经通过给定的站点绘制了路线。现在我想通过这条路线移动公共汽车。为了通过路径更平滑地渲染公交车,我必须在起始坐标和结束坐标之间找到多个位置。这些地方应该有公路运输。我怎样才能实现它? 这是四站。
Geopath path = new Geopath(new List<BasicGeoposition>(){
new BasicGeoposition()
{
Latitude= 1.2989658333333334, Longitude=103.8004543333333
} ,
new BasicGeoposition()
{
Latitude=1.3027026666666668, Longitude=103.80124616666667
} ,
new BasicGeoposition()
{
Latitude=1.3062241666666665, Longitude=103.80175516666667
} ,
new BasicGeoposition()
{
Latitude=1.3087055, Longitude=103.8026675
}
}
);
您可以使用:
MapRouteFinder.GetDrivingRouteAsync(Geopoint, Geopoint)
传入开始和结束位置,它 returns 一个 MapRouteFinderResult 对象。
BasicGeoposition startLocation = new BasicGeoposition() {Latitude=47.643,Longitude=-122.131};
// End at the city of Seattle, Washington.
BasicGeoposition endLocation = new BasicGeoposition() {Latitude = 47.604,Longitude= -122.329};
// Get the route between the points.
MapRouteFinderResult routeResult =
await MapRouteFinder.GetDrivingRouteAsync(
new Geopoint(startLocation),
new Geopoint(endLocation),
MapRouteOptimization.Time,
MapRouteRestrictions.None);
- MapRouteFinderResult 有一个 'Route' 属性 类型的 MapRoute。
- MapRoute 有一个 'Path' 属性 类型的 GeoPath。
- GeoPath 有一个 IReadOnlyList 类型的“位置”属性,它可以为您提供坐标。
完整的例子可以在这里找到:
https://docs.microsoft.com/nl-nl/windows/uwp/maps-and-location/routes-and-directions