]) ) .map((row) => row.join(',')) .join('\n') } const outputPath = path.resolve(__dirname, OUTPUT) fs.writeFileSync(`${outputPath}/point-grid.geo.json`, JSON.stringify(pointGrid)) fs.writeFileSync(`${outputPath}/point-set.geo.json`, JSON.stringify(pointSet)) fs.writeFileSync(`${outputPath}/point-grid.csv`, csvs.pointGrid) fs.writeFileSync(`${outputPath}/point-set.csv`, csvs.pointSet) // for my future self console.log(` Starting Parameters buffer: ${BUFFER} ${UNIT} distance: ${DISTANCE} ${UNIT} Generated Point Grid width: ${width} height: ${height} points: ${pointGrid.features.length} Generated Point Set points: ${pointSet.features.length} Expected Points in Point Set geojson: ${Math.round(turf.area(geojson) / 1000 / 1000)} km square points: ${(Math.round(turf.area(geojson) / 1000 / 1000) / DISTANCE / DISTANCE)} `)
getArea(feature) { let area = turf.area(feature); return area; }