I have some locations given for example:- a to point b, point c to point d.
Point a to b should be drawn in red colour and point d to c should be drawn in yellow colour. This point c and point d will be moving vehicles, so it will be dynamic.
currently
func initializePolylineAnnotation2(_newLocation: CLLocation)
{
//self.polyline.strokeColor = UIColor(red:1.00, green:0.84, blue:0.00, alpha:1.0)
//self.polyline.strokeWidth = 5.0
var polyline = GMSPolyline()
let solidRed = GMSStrokeStyle.solidColor(UIColor(red:1.00, green:0.84, blue:0.00, alpha:1.0))
polyline.spans = [GMSStyleSpan(style: solidRed)]
polyline.map = self.mapView
self.updateOverlay(_newLocation,polyline: polyline)
self.updateCurrentPositionMarker(_newLocation)
}
func updateOverlay(_ currentPosition: CLLocation,polyline : GMSPolyline)
{
self.path.add(currentPosition.coordinate)
polyline.path = self.path
if self.DBidArr.contains(self.movingChannel)
{
let index = self.DBidArr.index(of: self.movingChannel)
if index! < self.pathDB.count
{
self.pathDB[index!].add(currentPosition.coordinate)
}
}
}