Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function makeFeatureCollectionFromArray(wkts: string[], properties?: any) {
const reader: any = new WKTReader()
const writer: any = new GeoJSONWriter()
const geometries = wkts.map(wkt => writer.write(reader.read(wkt)))
const features = geometries.map(geometry => ({ type: 'Feature', geometry } as IGeoJsonFeature))
if (properties)
features.forEach(f => f.properties = properties)
return {
type: 'FeatureCollection',
features,
}
}