({ name, resolution, source })
| 214 | } |
| 215 | |
| 216 | async function createSubunitsLayer({ name, resolution, source }) { |
| 217 | // Only include USA for 'usa' scope since the UN and NE borders don't match exactly and slivers of Canada creep in |
| 218 | const filter = name === 'usa' ? 'adm0_a3 === "USA"' : config.filters.subunits; |
| 219 | const inputFilePath = `${outputDirGeojson}/${getNEFilename({ resolution, source })}.geojson`; |
| 220 | const outputFilePath = `${outputDirGeojson}/${name}_${resolution}m/subunits.geojson`; |
| 221 | const commands = [ |
| 222 | inputFilePath, |
| 223 | `-filter '${filter}'`, |
| 224 | `-clip ${outputDirGeojson}/${name}_${resolution}m/countries.geojson`, // Clip to the continent |
| 225 | `-o ${outputFilePath}` |
| 226 | ].join(' '); |
| 227 | await mapshaper.runCommands(commands); |
| 228 | addCentroidsToGeojson(outputFilePath); |
| 229 | } |
| 230 | |
| 231 | async function convertLayersToTopojson({ name, resolution }) { |
| 232 | const regionDir = path.join(outputDirGeojson, `${name}_${resolution}m`); |
no test coverage detected
searching dependent graphs…