GeoJSON icon indicating copy to clipboard operation
GeoJSON copied to clipboard

can not create geoJSON file

Open aSeniyants opened this issue 2 years ago • 1 comments

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'

aSeniyants avatar Aug 18 '22 01:08 aSeniyants