Google Maps for iOS, swift - How to show entire polyline between markers?

后端 未结 4 677
Happy的楠姐
Happy的楠姐 2021-01-12 13:19

I am trying to fit a polyline in the google map view. The polyline was acquired through overview_polyline in the google maps directions api.

Wondering how I would b

4条回答
  •  春和景丽
    2021-01-12 13:46

    You can zoom the map according the route or line displayed in the mapview. So that your route is displayed with in the mapView bounds.

    let bounds = GMSCoordinateBounds(path:path! )
    self.mapView!.animate(with: GMSCameraUpdate.fit(bounds, withPadding: 50.0))
    

    Here path is GMSPath of the route and mapView is GmsMapView.

提交回复
热议问题