Google Maps SDK 避开高速公路和收费站 (iOS)

Google Maps SDK avoid highways and tolls (iOS)

我已经阅读了两个 android and iOS 的文档,但只有我找不到,但我无法设法使 google 地图避开收费站或高速公路,这是我当前的代码(和&avoid=tfh 不适用于 iOS 对我来说)。文档中有没有什么方法可以避开高速公路和通行费?

        let ONE = getText("address")
        let TWO = getText("address2")

        Alamofire.request(.GET, "https://maps.googleapis.com/maps/api/directions/json?language=sv&origin=\(ONE)&destination=\(TWO)&mode=drive&avoid=tfh", parameters: ["foo": "bar"])
            .responseJSON { response in...

您可以在此视频中看到:Maps Shortcuts: Directions and the Google Maps iOS SDK on how to load and display information from the Directions web service in your app. You can read in this documentation avoid 参数指示计算出的路线应避开指示的特征。它支持以下参数:

  • tolls表示计算出的路线应避开收费站roads/bridges.
  • highways表示计算出的路线应避开高速公路

查看相关主题:

  • How to avoid both tolls and highways for Restrictions in Google Directions API?

希望对您有所帮助!