File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
Filter options
Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
Original file line number Diff line number Diff line change @@ -231,16 +231,18 @@ async function convertLayersToTopojson({ name, resolution }) {
231
231
232
232
// Get polygon features from UN GeoJSON
233
233
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 ( ' ' ) ;
236
237
await mapshaper . runCommands ( commandsAllFeatures ) ;
237
238
238
- const geojson = getJsonFile ( outputFilePath ) ;
239
+ const geojson = getJsonFile ( outputFilePath50m ) ;
239
240
const simplifiedGeojson = {
240
241
...geojson ,
241
242
features : geojson . features . map ( ( f ) => simplify ( f , { tolerance : 0.01 , highQuality : true } ) )
242
243
} ;
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 ) ) ;
244
246
245
247
for ( const resolution of resolutions ) {
246
248
for ( const { source } of Object . values ( vectors ) ) {
You can’t perform that action at this time.
0 commit comments