(geojsonPath)
| 46 | } |
| 47 | |
| 48 | function addCentroidsToGeojson(geojsonPath) { |
| 49 | const geojson = getJsonFile(geojsonPath); |
| 50 | if (!geojson.features) return; |
| 51 | |
| 52 | const features = geojson.features.map((feature) => { |
| 53 | const centroid = getCentroid(feature); |
| 54 | feature.properties.ct = centroid; |
| 55 | |
| 56 | return feature; |
| 57 | }); |
| 58 | |
| 59 | fs.writeFileSync(geojsonPath, JSON.stringify({ ...geojson, features })); |
| 60 | } |
| 61 | |
| 62 | // Wind the polygon rings in the correct direction to indicate what is solid and what is whole |
| 63 | const rewindGeojson = (geojson, clockwise = true) => rewind(geojson, clockwise); |
no test coverage detected
searching dependent graphs…