@@ -142,7 +142,7 @@ async function createLandLayer({ bounds, name, resolution, source }) {
142
142
const outputFilePath = `${ outputDirGeojson } /${ name } _${ resolution } m/land.geojson` ;
143
143
const commands = [
144
144
inputFilePath ,
145
- '-dissolve ' ,
145
+ '-dissolve2 ' ,
146
146
bounds . length ? `-clip bbox=${ bounds . join ( ',' ) } ` : '' ,
147
147
`-o ${ outputFilePath } `
148
148
] . join ( ' ' ) ;
@@ -200,7 +200,10 @@ async function createLakesLayer({ name, resolution, source }) {
200
200
}
201
201
202
202
async function createSubunitsLayer ( { name, resolution, source } ) {
203
- const filter = [ 'AUS' , 'BRA' , 'CAN' , 'USA' ] . map ( ( id ) => `adm0_a3 === "${ id } "` ) . join ( ' || ' ) ;
203
+ // Only include USA for 'usa' scope since the UN and NE borders don't match exactly and slivers of Canada creep in
204
+ const filter = ( name === 'usa' ? [ 'USA' ] : [ 'AUS' , 'BRA' , 'CAN' , 'USA' ] )
205
+ . map ( ( id ) => `adm0_a3 === "${ id } "` )
206
+ . join ( ' || ' ) ;
204
207
const inputFilePath = `${ outputDirGeojson } /${ getNEFilename ( { resolution, source } ) } .geojson` ;
205
208
const outputFilePath = `${ outputDirGeojson } /${ name } _${ resolution } m/subunits.geojson` ;
206
209
const commands = [
@@ -365,7 +368,8 @@ const commandsCountries50m = [
365
368
`-each 'if (globalid === "{9FD54A50-0BFB-4385-B342-1C3BDEE5ED9B}") iso3cd = "XBT"'` , // Bir Tawil
366
369
`-each 'if (iso3cd) iso3cd = iso3cd.toUpperCase()'` ,
367
370
`-filter '${ filters . countries } '` ,
368
- '-clean' ,
371
+ // Snap polygons to clean up land, coastlines layers
372
+ '-clean snap-interval=0.00013' ,
369
373
`-o ${ outputFilePathCountries50m } `
370
374
] . join ( ' ' ) ;
371
375
await mapshaper . runCommands ( commandsCountries50m ) ;
0 commit comments