I made a some Swift version for MultiPolygon
import Foundation
import MapKit
struct MapGeoGeometry: Codable {
let type: String
let coordinates: [[[[Double]]]]
}
struct MapGeoFeature: Codable {
let type: String
let geometry: MapGeoGeometry
}
extension MapGeoFeature {
func toPolygons() -> [MKPolygon] {
return geometry.coordinates
.map { data in return data.map { MapGeoFeature.polygon(from: $0) } }
.reduce([], +)
}
static func polygon(from points: [[Double]]) -> MKPolygon {
let coords = points.map { CLLocationCoordinate2D(latitude: $0[1], longitude: $0[0]) }
return MKPolygon(coordinates: coords, count: coords.count, interiorPolygons: nil)
}
}
HHLViewController
is. – Burkey