【发布时间】:2018-08-04 08:48:59
【问题描述】:
想要从 userLocation 绘制一条折线到多个标记。在我的代码中已经在数组中添加了标记坐标,然后将 userLocation 添加到该数组的第 0 个位置。现在我想在数组元素之间绘制一条路线折线。我的代码如下...
self.coods.append(self.currentLocation)
let jsonResponse = response.data
do{
let json = try JSON(data: jsonResponse!)
self.dictXYZ = [json]
print("JsonResponse printed \(json["data"][0]["lattitude"])")
if let array = json["data"].array{
for i in 0..<array.count{
var coordinate = CLLocationCoordinate2D()
coordinate.latitude = array[i]["lattitude"].doubleValue
coordinate.longitude = array[i]["longitude"].doubleValue
self.coods.append(coordinate)
}
for j in self.coods {
let marker = GMSMarker()
marker.position = j
let camera = GMSCameraPosition.camera(withLatitude: j.latitude, longitude: j.longitude, zoom: 12)
self.mapView.camera = camera
marker.map = self.mapView
}
【问题讨论】:
标签: ios swift xcode google-maps google-polyline