答案 0 :(得分:2)
您只需绘制具有相同路径的2条折线。
我们假设您已经使用缓冲坐标创建了变量thePath
。
您已经使用此路径创建了折线。
let redPolyline = GMSPolyline()
redPolyline.path = thePath
redPolyline.map = mapview
创建另一个。
let redPolyline = GMSPolyline()
redPolyline.path = thePath
redPolyline.strokeWidth = 6.0 // Change it accordingly
redPolyline.strokeWidth = UIColor.redColor().colorWithAlphaComponent(0.5) // Change it accordingly
redPolyline.map = mapview
请记住,redPolyline的zIndex
应该高于bluePolyline,因为正如我在您提供的图片中看到的那样,redPolyline位于另一个之上。
答案 1 :(得分:0)
If you want to draw polygone on Google map with array coordinates use this function:
func addPloygone(){
let path = GMSMutablePath()
path.removeAllCoordinates()
for i in places{
path.add(CLLocationCoordinate2D(latitude:i.lon!, longitude:i.lat!))
let polyline = GMSPolygon(path: path)
polyline.geodesic = true
polyline.map = map
polyline.strokeColor = UIColor.black
polyline.fillColor = UIColor.init(colorLiteralRed:176/255, green: 143/255, blue:52/255, alpha: 0.6)
}
}