-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat: Switch geodata providers #7393
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 1 commit
e8d763d
7f7b690
6b596c0
353bf94
fc6022f
2910eea
5d66dad
3b47c67
b434656
a4d0b21
e257b7b
1154ff1
86d5b00
86f048c
ac61095
f4c3d48
22a8e0a
247f925
3cf9730
24e8558
b2ae532
85ad69c
b903b9f
e74c65c
33a2e00
4868250
bce8d21
da44084
69f104e
c684b72
362233a
4d37b8c
bb8377b
6356355
5482adf
2710e7c
b8bfea6
d6ea8ab
3ec56ab
79017d5
0f9049c
4a6fb9d
33d3425
c74f711
f7cdc5f
9711ef7
51a596e
40968da
5e7efc8
9026b55
597ae5c
15dd77a
e385014
d3940c6
d7d7d0b
eb1e966
60171d7
90554a2
d836db9
3ddc6e0
f952173
75e9f52
3a7bd66
a6efc84
4f4bbfc
434017f
9a4a966
1f336e1
1bd2fc2
6dae5aa
665c892
ae3c471
a2cce65
7112d33
6e25a5f
ecd469f
50377f8
601ffc9
0f3e102
9b62be0
0539623
fc3978c
b050574
e9c16c8
fcaef12
36f5fb5
765b549
8944398
7410c34
5b3e36c
9cbd6c6
9d2aa71
0d6b5b7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Refactor to simplify scripts Switch to UN/NE geodata hybrid Save UN geodata to archive Remove extra info from topojson Add centroids to geojson Use 'simplify' to create 110m maps
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -1,153 +1,111 @@ | ||||
const source = { | ||||
coastlines: 'GEOA_simplified', | ||||
countries: 'BNDA_simplified', | ||||
land: 'countries', | ||||
ocean: 'GEOA_simplified', | ||||
waterbodies: 'WBYA_simplified' | ||||
}; | ||||
|
||||
const config = { | ||||
resolutions: [110, 50], | ||||
// This mapping is no longer used, but keeping for info | ||||
regionMapping: { | ||||
AFE: 'africa', | ||||
AFW: 'africa', | ||||
AFR: 'africa', | ||||
AME: 'americas', | ||||
NAM: 'north-america', | ||||
LAC: 'south-america', | ||||
ASI: 'asia', | ||||
EUR: 'europe', | ||||
OCE: 'oceania', | ||||
ANT: 'antarctica', | ||||
WORLD: 'world' | ||||
}, | ||||
resolutions: [50, 110], | ||||
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.
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. The 110m maps are a simplified version of the 50m maps. I haven't been able to get any confirmation as to what the UN data resolution actually is, so these labels aren't necessarily correct. In absence of a better solution, I left them as is. 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. Noting that the topojson files are overwritten on the CDN during the release process here: plotly.js/tasks/cdn_publish.sh Line 32 in 5e2163b
this PR could have sudden impact on users using old and new versions. Is that what we really want? Or should we rename new topojson files to avoid this issue? cc: @gvwilson @emilykl @ndrezn @alexcjohnson |
||||
scopes: [ | ||||
{ | ||||
name: 'africa', | ||||
specs: { | ||||
source, | ||||
acceptedFeatures: [ | ||||
{ | ||||
key: 'georeg', | ||||
values: ['AFE', 'AFR', 'AFW'] | ||||
} | ||||
], | ||||
filter: 'georeg === "AFR"', | ||||
bounds: [-30, -50, 60, 50] | ||||
} | ||||
}, | ||||
{ | ||||
name: 'antarctica', | ||||
specs: { | ||||
source, | ||||
acceptedFeatures: [ | ||||
{ | ||||
key: 'georeg', | ||||
values: ['ANT'] | ||||
} | ||||
], | ||||
filter: 'georeg === "ANT"', | ||||
bounds: [-180, -90, 180, -50] | ||||
} | ||||
}, | ||||
{ | ||||
name: 'asia', | ||||
specs: { | ||||
source, | ||||
acceptedFeatures: [ | ||||
{ | ||||
key: 'georeg', | ||||
values: ['ASI'] | ||||
} | ||||
], | ||||
filter: 'georeg === "ASI"', | ||||
bounds: [15, -90, 180, 85] | ||||
} | ||||
}, | ||||
{ | ||||
name: 'europe', | ||||
specs: { | ||||
source, | ||||
acceptedFeatures: [ | ||||
{ | ||||
key: 'georeg', | ||||
values: ['EUR'] | ||||
} | ||||
], | ||||
filter: 'georeg === "EUR"', | ||||
bounds: [-30, 0, 60, 90] | ||||
} | ||||
}, | ||||
{ | ||||
name: 'north-america', | ||||
specs: { | ||||
source, | ||||
acceptedFeatures: [ | ||||
{ | ||||
key: 'georeg', | ||||
values: ['AME'] | ||||
} | ||||
], | ||||
excludedFeatures: [ | ||||
{ | ||||
key: 'intreg', | ||||
values: ['South America'] | ||||
} | ||||
], | ||||
filter: 'subreg === "Northern America" || ["Central America", "Caribbean"].includes(intreg)', | ||||
bounds: [-180, 0, -45, 85] | ||||
} | ||||
}, | ||||
{ | ||||
name: 'oceania', | ||||
specs: { | ||||
source, | ||||
acceptedFeatures: [ | ||||
{ | ||||
key: 'georeg', | ||||
values: ['OCE'] | ||||
} | ||||
], | ||||
filter: 'georeg === "OCE"', | ||||
bounds: [-180, -50, 180, 25] | ||||
} | ||||
}, | ||||
{ | ||||
name: 'south-america', | ||||
specs: { | ||||
source, | ||||
acceptedFeatures: [ | ||||
{ | ||||
key: 'intreg', | ||||
values: ['South America'] | ||||
} | ||||
], | ||||
filter: 'intreg === "South America"', | ||||
bounds: [-100, -70, -30, 25] | ||||
} | ||||
}, | ||||
{ | ||||
name: 'usa', | ||||
specs: { | ||||
source, | ||||
acceptedFeatures: [ | ||||
{ | ||||
key: 'iso3cd', | ||||
values: ['USA'] | ||||
} | ||||
], | ||||
filter: 'iso3cd === "USA" && ![4, undefined].includes(stscod)', | ||||
bounds: [-180, 0, -45, 85] | ||||
} | ||||
}, | ||||
{ | ||||
name: 'world', | ||||
specs: { | ||||
source, | ||||
acceptedFeatures: [], | ||||
filter: '', | ||||
bounds: [] | ||||
} | ||||
} | ||||
], | ||||
simplifyTolerance: 0.01, | ||||
outputDirGeojson: './build/geodata/geojson', | ||||
outputDirTopojson: './dist/topojson', | ||||
inputDir: './build/geodata', | ||||
shapefiles: ['BNDA_simplified', 'GEOA_simplified', 'WBYA_simplified'], | ||||
downloadUrl: 'https://geoportal.un.org/arcgis/sharing/rest/content/items/f86966528d5943efbdb83fd521dc0943/data' | ||||
vectors: { | ||||
// 'coastlines', 'countries', and 'land' are derived from UN geodata | ||||
ocean: 'ocean', | ||||
lakes: 'lakes', | ||||
rivers: 'rivers_lake_centerlines', | ||||
subunits: 'admin_1_states_provinces_lakes' | ||||
}, | ||||
layers: { | ||||
coastlines: 'land', | ||||
countries: 'countries', | ||||
ocean: 'land', | ||||
lakes: 'lakes', | ||||
land: 'land', | ||||
rivers: 'rivers_lake_centerlines', | ||||
subunits: 'admin_1_states_provinces_lakes' | ||||
}, | ||||
unFilename: 'un_geodata_simplified', | ||||
unDownloadUrl: 'https://geoportal.un.org/arcgis/sharing/rest/content/items/d7caaff3ef4b4f7c82689b7c4694ad92/data', | ||||
filters: { | ||||
countries: 'stscod !== undefined', | ||||
land: [ | ||||
'{839C9589-44D9-4BD5-A681-13E10ED03C5E}', // AME | ||||
'{2EE1B4A5-9C3F-445C-A1AB-399715463785}', // ANT | ||||
'{3D11547B-94D9-42C9-B849-14B389FE5F7F}', // OCE | ||||
'{32DB79BE-0D53-46BD-995F-EBE7C30ED6B6}', // AFR | ||||
'{3F3547E7-C7FB-4347-9D80-575C6485FD2E}', // EUR | ||||
'{4351AA38-B383-44BF-8341-720DD74872B4}' // ASI | ||||
] | ||||
.map((id) => `globalid === "${id}"`) | ||||
.join(' || '), | ||||
subunits: ['AUS', 'BRA', 'CAN', 'USA'].map((id) => `adm0_a3 === "${id}"`).join(' || ') | ||||
} | ||||
}; | ||||
|
||||
export const getNEFilename = ({ resolution, source }) => `ne_${resolution}m_${source}`; | ||||
|
||||
export function getNEDownloadUrl({ resolution, vector: { source, type } }) { | ||||
return `https://naciscdn.org/naturalearth/${resolution}m/${type}/${getNEFilename({ resolution, source })}.zip`; | ||||
} | ||||
|
||||
export default config; |
Uh oh!
There was an error while loading. Please reload this page.