Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 86f048c

Browse filesBrowse files
committed
Switch to UN/NE geodata hybrid
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
1 parent 86d5b00 commit 86f048c
Copy full SHA for 86f048c

File tree

Expand file treeCollapse file tree

6 files changed

+379
-242
lines changed
Filter options
Expand file treeCollapse file tree

6 files changed

+379
-242
lines changed

‎package-lock.json

Copy file name to clipboardExpand all lines: package-lock.json
+38-5Lines changed: 38 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

Copy file name to clipboardExpand all lines: package.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@
8888
"css-loader": "^7.1.2",
8989
"d3-force": "^1.2.1",
9090
"d3-format": "^1.4.5",
91-
"d3-geo": "^1.12.1",
9291
"d3-geo-projection": "^2.9.0",
9392
"d3-hierarchy": "^1.1.9",
9493
"d3-interpolate": "^3.0.1",
@@ -136,6 +135,7 @@
136135
"canvas": "^2.11.2",
137136
"check-node-version": "^4.2.1",
138137
"chttps": "^1.0.6",
138+
"d3-geo": "^3.1.1",
139139
"deep-equal": "^2.2.3",
140140
"ecstatic": "^4.1.4",
141141
"esbuild": "^0.23.1",

‎tasks/topojson/config.mjs

Copy file name to clipboard
+48-90Lines changed: 48 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,153 +1,111 @@
1-
const source = {
2-
coastlines: 'GEOA_simplified',
3-
countries: 'BNDA_simplified',
4-
land: 'countries',
5-
ocean: 'GEOA_simplified',
6-
waterbodies: 'WBYA_simplified'
7-
};
8-
91
const config = {
10-
resolutions: [110, 50],
11-
// This mapping is no longer used, but keeping for info
12-
regionMapping: {
13-
AFE: 'africa',
14-
AFW: 'africa',
15-
AFR: 'africa',
16-
AME: 'americas',
17-
NAM: 'north-america',
18-
LAC: 'south-america',
19-
ASI: 'asia',
20-
EUR: 'europe',
21-
OCE: 'oceania',
22-
ANT: 'antarctica',
23-
WORLD: 'world'
24-
},
2+
resolutions: [50, 110],
253
scopes: [
264
{
275
name: 'africa',
286
specs: {
29-
source,
30-
acceptedFeatures: [
31-
{
32-
key: 'georeg',
33-
values: ['AFE', 'AFR', 'AFW']
34-
}
35-
],
7+
filter: 'georeg === "AFR"',
368
bounds: [-30, -50, 60, 50]
379
}
3810
},
3911
{
4012
name: 'antarctica',
4113
specs: {
42-
source,
43-
acceptedFeatures: [
44-
{
45-
key: 'georeg',
46-
values: ['ANT']
47-
}
48-
],
14+
filter: 'georeg === "ANT"',
4915
bounds: [-180, -90, 180, -50]
5016
}
5117
},
5218
{
5319
name: 'asia',
5420
specs: {
55-
source,
56-
acceptedFeatures: [
57-
{
58-
key: 'georeg',
59-
values: ['ASI']
60-
}
61-
],
21+
filter: 'georeg === "ASI"',
6222
bounds: [15, -90, 180, 85]
6323
}
6424
},
6525
{
6626
name: 'europe',
6727
specs: {
68-
source,
69-
acceptedFeatures: [
70-
{
71-
key: 'georeg',
72-
values: ['EUR']
73-
}
74-
],
28+
filter: 'georeg === "EUR"',
7529
bounds: [-30, 0, 60, 90]
7630
}
7731
},
7832
{
7933
name: 'north-america',
8034
specs: {
81-
source,
82-
acceptedFeatures: [
83-
{
84-
key: 'georeg',
85-
values: ['AME']
86-
}
87-
],
88-
excludedFeatures: [
89-
{
90-
key: 'intreg',
91-
values: ['South America']
92-
}
93-
],
35+
filter: 'subreg === "Northern America" || ["Central America", "Caribbean"].includes(intreg)',
9436
bounds: [-180, 0, -45, 85]
9537
}
9638
},
9739
{
9840
name: 'oceania',
9941
specs: {
100-
source,
101-
acceptedFeatures: [
102-
{
103-
key: 'georeg',
104-
values: ['OCE']
105-
}
106-
],
42+
filter: 'georeg === "OCE"',
10743
bounds: [-180, -50, 180, 25]
10844
}
10945
},
11046
{
11147
name: 'south-america',
11248
specs: {
113-
source,
114-
acceptedFeatures: [
115-
{
116-
key: 'intreg',
117-
values: ['South America']
118-
}
119-
],
49+
filter: 'intreg === "South America"',
12050
bounds: [-100, -70, -30, 25]
12151
}
12252
},
12353
{
12454
name: 'usa',
12555
specs: {
126-
source,
127-
acceptedFeatures: [
128-
{
129-
key: 'iso3cd',
130-
values: ['USA']
131-
}
132-
],
56+
filter: 'iso3cd === "USA" && ![4, undefined].includes(stscod)',
13357
bounds: [-180, 0, -45, 85]
13458
}
13559
},
13660
{
13761
name: 'world',
13862
specs: {
139-
source,
140-
acceptedFeatures: [],
63+
filter: '',
14164
bounds: []
14265
}
14366
}
14467
],
145-
simplifyTolerance: 0.01,
14668
outputDirGeojson: './build/geodata/geojson',
14769
outputDirTopojson: './dist/topojson',
14870
inputDir: './build/geodata',
149-
shapefiles: ['BNDA_simplified', 'GEOA_simplified', 'WBYA_simplified'],
150-
downloadUrl: 'https://geoportal.un.org/arcgis/sharing/rest/content/items/f86966528d5943efbdb83fd521dc0943/data'
71+
vectors: {
72+
// 'coastlines', 'countries', and 'land' are derived from UN geodata
73+
ocean: 'ocean',
74+
lakes: 'lakes',
75+
rivers: 'rivers_lake_centerlines',
76+
subunits: 'admin_1_states_provinces_lakes'
77+
},
78+
layers: {
79+
coastlines: 'land',
80+
countries: 'countries',
81+
ocean: 'land',
82+
lakes: 'lakes',
83+
land: 'land',
84+
rivers: 'rivers_lake_centerlines',
85+
subunits: 'admin_1_states_provinces_lakes'
86+
},
87+
unFilename: 'un_geodata_simplified',
88+
unDownloadUrl: 'https://geoportal.un.org/arcgis/sharing/rest/content/items/d7caaff3ef4b4f7c82689b7c4694ad92/data',
89+
filters: {
90+
countries: 'stscod !== undefined',
91+
land: [
92+
'{839C9589-44D9-4BD5-A681-13E10ED03C5E}', // AME
93+
'{2EE1B4A5-9C3F-445C-A1AB-399715463785}', // ANT
94+
'{3D11547B-94D9-42C9-B849-14B389FE5F7F}', // OCE
95+
'{32DB79BE-0D53-46BD-995F-EBE7C30ED6B6}', // AFR
96+
'{3F3547E7-C7FB-4347-9D80-575C6485FD2E}', // EUR
97+
'{4351AA38-B383-44BF-8341-720DD74872B4}' // ASI
98+
]
99+
.map((id) => `globalid === "${id}"`)
100+
.join(' || '),
101+
subunits: ['AUS', 'BRA', 'CAN', 'USA'].map((id) => `adm0_a3 === "${id}"`).join(' || ')
102+
}
151103
};
152104

105+
export const getNEFilename = ({ resolution, source }) => `ne_${resolution}m_${source}`;
106+
107+
export function getNEDownloadUrl({ resolution, vector: { source, type } }) {
108+
return `https://naciscdn.org/naturalearth/${resolution}m/${type}/${getNEFilename({ resolution, source })}.zip`;
109+
}
110+
153111
export default config;

‎tasks/topojson/geodata.zip

Copy file name to clipboard
-3.26 MB
Binary file not shown.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.