|
1 |
| -const source = { |
2 |
| - coastlines: 'GEOA_simplified', |
3 |
| - countries: 'BNDA_simplified', |
4 |
| - land: 'countries', |
5 |
| - ocean: 'GEOA_simplified', |
6 |
| - waterbodies: 'WBYA_simplified' |
7 |
| -}; |
8 |
| - |
9 | 1 | 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], |
25 | 3 | scopes: [
|
26 | 4 | {
|
27 | 5 | name: 'africa',
|
28 | 6 | specs: {
|
29 |
| - source, |
30 |
| - acceptedFeatures: [ |
31 |
| - { |
32 |
| - key: 'georeg', |
33 |
| - values: ['AFE', 'AFR', 'AFW'] |
34 |
| - } |
35 |
| - ], |
| 7 | + filter: 'georeg === "AFR"', |
36 | 8 | bounds: [-30, -50, 60, 50]
|
37 | 9 | }
|
38 | 10 | },
|
39 | 11 | {
|
40 | 12 | name: 'antarctica',
|
41 | 13 | specs: {
|
42 |
| - source, |
43 |
| - acceptedFeatures: [ |
44 |
| - { |
45 |
| - key: 'georeg', |
46 |
| - values: ['ANT'] |
47 |
| - } |
48 |
| - ], |
| 14 | + filter: 'georeg === "ANT"', |
49 | 15 | bounds: [-180, -90, 180, -50]
|
50 | 16 | }
|
51 | 17 | },
|
52 | 18 | {
|
53 | 19 | name: 'asia',
|
54 | 20 | specs: {
|
55 |
| - source, |
56 |
| - acceptedFeatures: [ |
57 |
| - { |
58 |
| - key: 'georeg', |
59 |
| - values: ['ASI'] |
60 |
| - } |
61 |
| - ], |
| 21 | + filter: 'georeg === "ASI"', |
62 | 22 | bounds: [15, -90, 180, 85]
|
63 | 23 | }
|
64 | 24 | },
|
65 | 25 | {
|
66 | 26 | name: 'europe',
|
67 | 27 | specs: {
|
68 |
| - source, |
69 |
| - acceptedFeatures: [ |
70 |
| - { |
71 |
| - key: 'georeg', |
72 |
| - values: ['EUR'] |
73 |
| - } |
74 |
| - ], |
| 28 | + filter: 'georeg === "EUR"', |
75 | 29 | bounds: [-30, 0, 60, 90]
|
76 | 30 | }
|
77 | 31 | },
|
78 | 32 | {
|
79 | 33 | name: 'north-america',
|
80 | 34 | 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)', |
94 | 36 | bounds: [-180, 0, -45, 85]
|
95 | 37 | }
|
96 | 38 | },
|
97 | 39 | {
|
98 | 40 | name: 'oceania',
|
99 | 41 | specs: {
|
100 |
| - source, |
101 |
| - acceptedFeatures: [ |
102 |
| - { |
103 |
| - key: 'georeg', |
104 |
| - values: ['OCE'] |
105 |
| - } |
106 |
| - ], |
| 42 | + filter: 'georeg === "OCE"', |
107 | 43 | bounds: [-180, -50, 180, 25]
|
108 | 44 | }
|
109 | 45 | },
|
110 | 46 | {
|
111 | 47 | name: 'south-america',
|
112 | 48 | specs: {
|
113 |
| - source, |
114 |
| - acceptedFeatures: [ |
115 |
| - { |
116 |
| - key: 'intreg', |
117 |
| - values: ['South America'] |
118 |
| - } |
119 |
| - ], |
| 49 | + filter: 'intreg === "South America"', |
120 | 50 | bounds: [-100, -70, -30, 25]
|
121 | 51 | }
|
122 | 52 | },
|
123 | 53 | {
|
124 | 54 | name: 'usa',
|
125 | 55 | specs: {
|
126 |
| - source, |
127 |
| - acceptedFeatures: [ |
128 |
| - { |
129 |
| - key: 'iso3cd', |
130 |
| - values: ['USA'] |
131 |
| - } |
132 |
| - ], |
| 56 | + filter: 'iso3cd === "USA" && ![4, undefined].includes(stscod)', |
133 | 57 | bounds: [-180, 0, -45, 85]
|
134 | 58 | }
|
135 | 59 | },
|
136 | 60 | {
|
137 | 61 | name: 'world',
|
138 | 62 | specs: {
|
139 |
| - source, |
140 |
| - acceptedFeatures: [], |
| 63 | + filter: '', |
141 | 64 | bounds: []
|
142 | 65 | }
|
143 | 66 | }
|
144 | 67 | ],
|
145 |
| - simplifyTolerance: 0.01, |
146 | 68 | outputDirGeojson: './build/geodata/geojson',
|
147 | 69 | outputDirTopojson: './dist/topojson',
|
148 | 70 | 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 | + } |
151 | 103 | };
|
152 | 104 |
|
| 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 | + |
153 | 111 | export default config;
|
0 commit comments