MCPcopy Create free account
hub / github.com/plotly/plotly.js / createSubunitsLayer

Function createSubunitsLayer

topojson/bin/process_geodata.mjs:216–229  ·  view source on GitHub ↗
({ name, resolution, source })

Source from the content-addressed store, hash-verified

214}
215
216async 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
231async function convertLayersToTopojson({ name, resolution }) {
232 const regionDir = path.join(outputDirGeojson, `${name}_${resolution}m`);

Callers 1

Calls 2

getNEFilenameFunction · 0.90
addCentroidsToGeojsonFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…