@@ -18,8 +18,6 @@ async function convertShpToGeo(filename) {
1818 const outputFilePath = `${ outputDirGeojson } /${ filename } .geojson` ;
1919 const commands = [ inputFilePath , `-proj wgs84` , `-o format=geojson ${ outputFilePath } ` ] . join ( ' ' ) ;
2020 await mapshaper . runCommands ( commands ) ;
21-
22- console . log ( `GeoJSON saved to ${ outputFilePath } ` ) ;
2321}
2422
2523function getJsonFile ( filename ) {
@@ -32,7 +30,6 @@ function getJsonFile(filename) {
3230}
3331
3432async function createCountriesLayer ( { bounds, filter, name, resolution, source } ) {
35- console . log ( `Building ${ resolution } m countries layer for '${ name } '` ) ;
3633 const inputFilePath = `${ outputDirGeojson } /${ unFilename } _${ resolution } m/${ source } .geojson` ;
3734 const outputFilePath = `${ outputDirGeojson } /${ name } _${ resolution } m/countries.geojson` ;
3835 const commands = [
@@ -43,7 +40,6 @@ async function createCountriesLayer({ bounds, filter, name, resolution, source }
4340 ] . join ( ' ' ) ;
4441 await mapshaper . runCommands ( commands ) ;
4542 addCentroidsToGeojson ( outputFilePath ) ;
46- // TODO: Add simplification command if on 110m resolution? Or take care of somewhere else?
4743}
4844
4945function addCentroidsToGeojson ( geojsonPath ) {
@@ -62,7 +58,6 @@ function addCentroidsToGeojson(geojsonPath) {
6258
6359async function createLandLayer ( { bounds, name, resolution, source } ) {
6460 // TODO: Figure out way to only include North and Central America via filter, dissolve
65- console . log ( `Building ${ resolution } m land layer for '${ name } '` ) ;
6661 const inputFilePath = `${ outputDirGeojson } /${ unFilename } _${ resolution } m/${ source } .geojson` ;
6762 const outputFilePath = `${ outputDirGeojson } /${ name } _${ resolution } m/land.geojson` ;
6863 const commands = [
@@ -75,7 +70,6 @@ async function createLandLayer({ bounds, name, resolution, source }) {
7570}
7671
7772async function createCoastlinesLayer ( { bounds, name, resolution, source } ) {
78- console . log ( `Building ${ resolution } m coastlines layer for '${ name } '` ) ;
7973 // TODO: Update source to be a path?
8074 const inputFilePath = `${ outputDirGeojson } /${ unFilename } _${ resolution } m/${ source } .geojson` ;
8175 const outputFilePath = `${ outputDirGeojson } /${ name } _${ resolution } m/coastlines.geojson` ;
@@ -90,7 +84,6 @@ async function createCoastlinesLayer({ bounds, name, resolution, source }) {
9084}
9185
9286async function createOceanLayer ( { bounds, name, resolution, source } ) {
93- console . log ( `Building ${ resolution } m ocean layer for '${ name } '` ) ;
9487 const inputFilePath = `./tasks/topojson/world_rectangle.geojson` ;
9588 const outputFilePath = `${ outputDirGeojson } /${ name } _${ resolution } m/ocean.geojson` ;
9689 const eraseFilePath = `${ outputDirGeojson } /${ unFilename } _${ resolution } m/${ source } .geojson` ;
@@ -104,7 +97,6 @@ async function createOceanLayer({ bounds, name, resolution, source }) {
10497}
10598
10699async function createRiversLayer ( { name, resolution, source } ) {
107- console . log ( `Building ${ resolution } m rivers layer for '${ name } '` ) ;
108100 const inputFilePath = `${ outputDirGeojson } /${ getNEFilename ( { resolution, source } ) } .geojson` ;
109101 const outputFilePath = `${ outputDirGeojson } /${ name } _${ resolution } m/rivers.geojson` ;
110102 const commands = [
@@ -116,7 +108,6 @@ async function createRiversLayer({ name, resolution, source }) {
116108}
117109
118110async function createLakesLayer ( { name, resolution, source } ) {
119- console . log ( `Building ${ resolution } m lakes layer for '${ name } '` ) ;
120111 const inputFilePath = `${ outputDirGeojson } /${ getNEFilename ( { resolution, source } ) } .geojson` ;
121112 const outputFilePath = `${ outputDirGeojson } /${ name } _${ resolution } m/lakes.geojson` ;
122113 const commands = [
@@ -128,7 +119,6 @@ async function createLakesLayer({ name, resolution, source }) {
128119}
129120
130121async function createSubunitsLayer ( { name, resolution, source } ) {
131- console . log ( `Building ${ resolution } m subunits layer for '${ name } '` ) ;
132122 const filter = [ 'AUS' , 'BRA' , 'CAN' , 'USA' ] . map ( ( id ) => `adm0_a3 === "${ id } "` ) . join ( ' || ' ) ;
133123 const inputFilePath = `${ outputDirGeojson } /${ getNEFilename ( { resolution, source } ) } .geojson` ;
134124 const outputFilePath = `${ outputDirGeojson } /${ name } _${ resolution } m/subunits.geojson` ;
@@ -211,10 +201,7 @@ function getCentroid(feature) {
211201
212202async function convertLayersToTopojson ( { name, resolution } ) {
213203 const regionDir = path . join ( outputDirGeojson , `${ name } _${ resolution } m` ) ;
214- if ( ! fs . existsSync ( regionDir ) ) {
215- console . log ( `Couldn't find ${ regionDir } ` ) ;
216- return ;
217- }
204+ if ( ! fs . existsSync ( regionDir ) ) return ;
218205
219206 const outputFile = `${ outputDirTopojson } /${ name } _${ resolution } m.json` ;
220207 // Layer names default to file names
@@ -225,8 +212,6 @@ async function convertLayersToTopojson({ name, resolution }) {
225212 const topojson = getJsonFile ( outputFile ) ;
226213 const prunedTopojson = pruneProperties ( topojson ) ;
227214 fs . writeFileSync ( outputFile , JSON . stringify ( prunedTopojson ) ) ;
228-
229- console . log ( `Topojson saved to: ${ outputFile } ` ) ;
230215}
231216
232217// Get polygon features from UN GeoJSON
0 commit comments