我正在尝试使用 google direction api 在多个地方之间绘制路径,但问题是当我缩放 map 时,路径绘制不正确。
我正在点击此 api 并使用来自 JSON 响应的“overview_polyline”点绘制路径。
let polygon = GMSPolygon()
polygon.path = GMSPath(fromEncodedPath: "\(self.overview_points)")
请帮我解决这个问题。 谢谢
最佳答案
使用GMSPolyline
而不是GMSPolygon
来绘制路径。
示例:
let path = GMSPath(fromEncodedPath: "\(self.overview_points)")
let directionPolyline = GMSPolyline(path: path)
directionPolyline.strokeColor = UIColor.blue
directionPolyline.strokeWidth = 3
directionPolyline.map = self.mapView
关于ios - 用google direction api绘制路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42889685/