I am new to maps technology. I am using Google apis to the the json data to fetch the routes on the map using the polyline.
I need some help regarding the polyline. I want to clear the path of polyline as per users drives through the route. I tried searching many solutions but they didn't work for me. I have attached an image for the same:
Function to draw polyline ---
func drawPath(from polyStr: String){
print("inside Drawpath")
path = GMSPath(fromEncodedPath: polyStr)!
let polyline = GMSPolyline(path: path)
polyline.strokeWidth = 6
polyline.map = myMapView // Google MapView
polyline.strokeColor = UIColor(red: 0, green: 128/255, blue: 1, alpha: 1)
// let camera = GMSCameraUpdate.fit(GMSCoordinateBounds(coordinate: CLLocationCoordinate2D(latitude: Double(lat), longitude: Double(long)), coordinate: CLLocationCoordinate2D(latitude: Double(directionlat)!, longitude: Double(directionlat)!)))
let cameraUpdate = GMSCameraUpdate.fit(GMSCoordinateBounds(coordinate: CLLocationCoordinate2D(latitude: Double(lat), longitude: Double(long)), coordinate: CLLocationCoordinate2D(latitude: Double(directionlat)!, longitude: Double(directionlat)!)))
// self.timer = Timer.scheduledTimer(timeInterval: 0.003, target: self, selector: #selector(animatePolylinePath), userInfo: nil, repeats: true)
//myMapView.moveCamera(cameraUpdate)
let currentZoom = myMapView.camera.zoom
// myMapView.animate(toZoom: currentZoom - 1.4)
}
What can I try next?