使用HERE Maps iOS SDK通过一组坐标创建路线时出现问题

我正在使用HERE Maps SDK创建带有一组坐标的路线。为此,我使用以下代码:

var linePoints = [[String:Any]]()
self.linePoints = [["lat":37.33292,"long":-122.01026],["lat":37.33305,"long":-122.01058],["lat":37.33336,"long":-122.01104],["lat":37.33376,"long":-122.01144],["lat":37.33375,["lat":37.33372,"long":-122.01147],["lat":37.33368,"long":-122.01156],["lat":37.33367,"long":-122.01172],["lat":37.33369,"long":-122.01183],["lat":37.33385,"long":-122.01208],["lat":37.33389,"long":-122.01217],"long":-122.01227],["lat":37.33388,"long":-122.0123],["lat":37.3338,"long":-122.01232],"long":-122.01241],["lat":37.33383,"long":-122.01263],["lat":37.36421,"long":-122.06282],["lat":37.36461,"long":-122.06286],["lat":37.36526,"long":-122.06301],["lat":37.36567,"long":-122.06313],["lat":37.36632,"long":-122.06341],["lat":37.36702,"long":-122.06381],["lat":37.37243,"long":-122.06709],["lat":37.37282,"long":-122.06732],["lat":37.37314,"long":-122.06747],["lat":37.37353,"long":-122.06761],["lat":37.37396,"long":-122.06773],["lat":37.37452,"long":-122.06782],["lat":37.37628,"long":-122.06425]]
var waypoints = [nmAWaypoint]()
    var geocordinates = nmAGeoCoordinates()
    for (index,dict) in self.linePoints.enumerated() {
        geocordinates = nmAGeoCoordinates(latitude: CLLocationDegrees(dict["lat"] as! Double),longitude: CLLocationDegrees(dict["long"] as! Double))
        if (index == 0) || (index == self.linePoints.count - 1) {
            waypoints.append(nmAWaypoint(geoCoordinates: geocordinates,waypointType: 
.stopWaypoint))
        } else {
            waypoints.append(nmAWaypoint(geoCoordinates: geocordinates,waypointType: .viaWaypoint))
        }
    }

使用以下功能来计算路线:

 coreRouter.calculateRoute(withStops: waypoints,routingMode: routingMode1) { (routeResult,error)

问题::它会在路径中创建带有很多循环(180度转弯或旋转)的路径。我为第一个和最后一个坐标传递waypointType“ .stopWaypoint”,为其余坐标传递“ .viaWaypoint”。请建议我我在做什么错。

使用HERE Maps iOS SDK通过一组坐标创建路线时出现问题

b0539323789 回答:使用HERE Maps iOS SDK通过一组坐标创建路线时出现问题

您能否使用以下文档中提到的步骤尝试复制示例:https://developer.here.com/documentation/android-premium/dev_guide/topics/import-route.html

如果您仍然使用以下坐标进行多次转弯,请给我们回信。地图匹配API还可以用于查看坐标在地图中的确切位置或在形成路线时它们是否相互交叉

本文链接:https://www.f2er.com/2881175.html

大家都在问