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
For Swift 2.0 Google Maps, to make your map view fit the polyline of the route you are drawing:
let path: GMSPath = GMSPath(fromEncodedPath: route)!
routePolyline = GMSPolyline(path: path)
routePolyline.map = mapView
var bounds = GMSCoordinateBounds()
for index in 1...path.count() {
bounds = bounds.includingCoordinate(path.coordinateAtIndex(index))
}
mapView.animateWithCameraUpdate(GMSCameraUpdate.fitBounds(bounds))