File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,20 @@ function getJsonFile(filename) {
3131 }
3232}
3333
34+ function createCountriesList ( geojsonPath , outputPath ) {
35+ const geojson = getJsonFile ( geojsonPath ) ;
36+ if ( ! geojson . features ) return ;
37+
38+ const countryData = geojson . features
39+ . map ( ( feature ) => {
40+ const { iso3cd, nam_en } = feature . properties ;
41+ return { iso3cd, name : nam_en } ;
42+ } )
43+ . sort ( ( a , b ) => a . name . localeCompare ( b . name ) ) ;
44+
45+ fs . writeFileSync ( outputPath , JSON . stringify ( countryData ) ) ;
46+ }
47+
3448function addCentroidsToGeojson ( geojsonPath ) {
3549 const geojson = getJsonFile ( geojsonPath ) ;
3650 if ( ! geojson . features ) return ;
@@ -375,6 +389,9 @@ const commandsCountries50m = [
375389await mapshaper . runCommands ( commandsCountries50m ) ;
376390clampToAntimeridian ( outputFilePathCountries50m ) ;
377391
392+ // Build list of countries, ISO codes for documentation
393+ createCountriesList ( outputFilePathCountries50m , `${ outputDirTopojson } /country_names_iso_codes.json` ) ;
394+
378395// Get land from all polygon features
379396const inputFilePathLand50m = outputFilePathCountries50m ;
380397const outputFilePathLand50m = `${ outputDirGeojson } /${ unFilename } _50m/land.geojson` ;
You can’t perform that action at this time.
0 commit comments