从iOS中的多段线集合计算预期行程时间

从iOS中的多段线集合计算预期行程时间,ios,google-maps,maps,mapkit,polyline,Ios,Google Maps,Maps,Mapkit,Polyline,我有一组定义管线的多段线。是否有某种方法可以使用mapkit计算这条路线的预期行程时间?如果不在MapKit中,那么在Google地图或任何其他地图api中 它必须来自多段线集合?所以你不能只使用从源头到目的地的预期时间?哦,你有一组定义路线的多段线。。。你也有一个包含这些多段线的MKRoute对象吗?我可能会做一个,但是我如何得到该路线的预期行程时间呢?我无法从MKRoute对象创建MKDirectionsRequest对象。MKRoute具有expectedTravelTime属性。对,但仅

我有一组定义管线的多段线。是否有某种方法可以使用mapkit计算这条路线的预期行程时间?如果不在MapKit中,那么在Google地图或任何其他地图api中

它必须来自多段线集合?所以你不能只使用从源头到目的地的预期时间?哦,你有一组定义路线的多段线。。。你也有一个包含这些多段线的MKRoute对象吗?我可能会做一个,但是我如何得到该路线的预期行程时间呢?我无法从MKRoute对象创建MKDirectionsRequest对象。MKRoute具有expectedTravelTime属性。对,但仅当您从MKDirectionsRequest调用获取MKRoute对象时
 let sourcePlaceMark = MKPlacemark(coordinate: fromCoordinate, addressDictionary: nil)
        let destPlaceMark = MKPlacemark(coordinate: toCoordinate, addressDictionary: nil)
        let from = MKMapItem(placemark: sourcePlaceMark)
        let to = MKMapItem(placemark: destPlaceMark)

        print("caculateDirections ")

        let request = MKDirectionsRequest()
        request.source = from
        request.destination = to
        request.transportType = .Automobile

        let directions = MKDirections(request: request)
directions.calculateDirectionsWithCompletionHandler { (response, error) -> Void in
                if let response = response {
                    // Here you can get the routes and draw it on the map

                    let routeSeconds = response.routes.first!.expectedTravelTime
                    let routeDistance = response.routes.first!.distance
                 }
    }