How to use the jsts/org/locationtech/jts/io/WKTReader function in jsts

To help you get started, we’ve selected a few jsts examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bjornharrtell / flatgeobuf / src / ts / geojson.spec.ts View on Github external
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,
  }
}