-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix: Fix USA subunits, clean up land, coastlines topojson layers #7555
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4018b70
49bd7ae
8c578e0
bc373de
de85545
3d935e7
8da774c
453853c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- Fix cropping of subunits in USA topojson, clean up land and coastlines layers for all topojson [#7555](https://github.com/plotly/plotly.js/pull/7555) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,7 +142,7 @@ async function createLandLayer({ bounds, name, resolution, source }) { | |
const outputFilePath = `${outputDirGeojson}/${name}_${resolution}m/land.geojson`; | ||
const commands = [ | ||
inputFilePath, | ||
'-dissolve', | ||
'-dissolve2', | ||
bounds.length ? `-clip bbox=${bounds.join(',')}` : '', | ||
`-o ${outputFilePath}` | ||
].join(' '); | ||
|
@@ -200,7 +200,10 @@ async function createLakesLayer({ name, resolution, source }) { | |
} | ||
|
||
async function createSubunitsLayer({ name, resolution, source }) { | ||
const filter = ['AUS', 'BRA', 'CAN', 'USA'].map((id) => `adm0_a3 === "${id}"`).join(' || '); | ||
// Only include USA for 'usa' scope since the UN and NE borders don't match exactly and slivers of Canada creep in | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
😄 |
||
const filter = (name === 'usa' ? ['USA'] : ['AUS', 'BRA', 'CAN', 'USA']) | ||
.map((id) => `adm0_a3 === "${id}"`) | ||
.join(' || '); | ||
const inputFilePath = `${outputDirGeojson}/${getNEFilename({ resolution, source })}.geojson`; | ||
const outputFilePath = `${outputDirGeojson}/${name}_${resolution}m/subunits.geojson`; | ||
const commands = [ | ||
|
@@ -365,7 +368,8 @@ const commandsCountries50m = [ | |
`-each 'if (globalid === "{9FD54A50-0BFB-4385-B342-1C3BDEE5ED9B}") iso3cd = "XBT"'`, // Bir Tawil | ||
`-each 'if (iso3cd) iso3cd = iso3cd.toUpperCase()'`, | ||
`-filter '${filters.countries}'`, | ||
'-clean', | ||
// Snap polygons to clean up land, coastlines layers | ||
'-clean snap-interval=0.000125', | ||
`-o ${outputFilePathCountries50m}` | ||
].join(' '); | ||
await mapshaper.runCommands(commandsCountries50m); | ||
|
@@ -384,9 +388,8 @@ const inputFilePathCountries110m = outputFilePathCountries50m; | |
const outputFilePathCountries110m = `${outputDirGeojson}/${unFilename}_110m/countries.geojson`; | ||
const commandsCountries110m = [ | ||
inputFilePathCountries110m, | ||
'-simplify 20%', | ||
// Use 'snap-interval' to fix alignment issues with continental USA, Alaska, and Mexico | ||
'-clean snap-interval=0.015', | ||
'-simplify 21%', | ||
'-clean', | ||
`-o ${outputFilePathCountries110m}` | ||
].join(' '); | ||
await mapshaper.runCommands(commandsCountries110m); | ||
|
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@camdecoster What is the effect of this config change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can override the global includes using this one. It included all the same stuff as the global one, so I removed it as redundant.