Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 22a8e0a

Browse filesBrowse files
committed
Fix saving 110m maps
1 parent f4c3d48 commit 22a8e0a
Copy full SHA for 22a8e0a

File tree

Expand file treeCollapse file tree

2 files changed

+7
-5
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+7
-5
lines changed

‎package-lock.json

Copy file name to clipboardExpand all lines: package-lock.json
+1-1Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎tasks/topojson/process_geodata.mjs

Copy file name to clipboardExpand all lines: tasks/topojson/process_geodata.mjs
+6-4Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,16 +231,18 @@ async function convertLayersToTopojson({ name, resolution }) {
231231

232232
// Get polygon features from UN GeoJSON
233233
const inputFilePath = `${inputDir}/${unFilename}.geojson`;
234-
const outputFilePath = `${outputDirGeojson}/${unFilename}_50m/all_features.geojson`;
235-
const commandsAllFeatures = [inputFilePath, `-o target=1 ${outputFilePath}`].join(' ');
234+
const outputFilePath50m = `${outputDirGeojson}/${unFilename}_50m/all_features.geojson`;
235+
const outputPath110m = `${outputDirGeojson}/${unFilename}_110m`;
236+
const commandsAllFeatures = [inputFilePath, `-o target=1 ${outputFilePath50m}`].join(' ');
236237
await mapshaper.runCommands(commandsAllFeatures);
237238

238-
const geojson = getJsonFile(outputFilePath);
239+
const geojson = getJsonFile(outputFilePath50m);
239240
const simplifiedGeojson = {
240241
...geojson,
241242
features: geojson.features.map((f) => simplify(f, { tolerance: 0.01, highQuality: true }))
242243
};
243-
fs.writeFileSync(`${outputDirGeojson}/${unFilename}_110m/all_features.geojson`, JSON.stringify(simplifiedGeojson));
244+
if (!fs.existsSync(outputPath110m)) fs.mkdirSync(outputPath110m, { recursive: true });
245+
fs.writeFileSync(`${outputPath110m}/all_features.geojson`, JSON.stringify(simplifiedGeojson));
244246

245247
for (const resolution of resolutions) {
246248
for (const { source } of Object.values(vectors)) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.