GeoJSON
GeoJSON copied to clipboard
can not create geoJSON file
Hello! I don't understand how i can create geoJSON file, please help me...
import GeoJSON
import MapKit
import AnyCodable
let coordArray: [CLLocationCoordinate2D] = [CLLocationCoordinate2D(latitude: 77, longitude: 44), CLLocationCoordinate2D(latitude: 78, longitude: 45), CLLocationCoordinate2D(latitude: 79, longitude: 46)]
let way = GeoJSONLineString(coordinates: coordArray)
let features: GeoJSONFeatureCollection = GeoJSONFeatureCollection(dictionary: way.dictionaryRepresentation)
let json = try JSONEncoder().encode(features)
and i have error: Instance method 'encode' requires that 'GeoJSONFeatureCollection' conform to 'Encodable'