优化中国台湾绘图

This commit is contained in:
CN-JS-HuiBai
2026-04-13 15:42:00 +08:00
parent 395b3f3c4e
commit 28667bcbee
2 changed files with 12 additions and 7 deletions

View File

@@ -1176,8 +1176,8 @@
'shanghai': [121.4737, 31.2304],
'hong kong': [114.1694, 22.3193],
'hk': [114.1694, 22.3193],
'taiwan': [120.9605, 23.6978],
'tw': [120.9605, 23.6978],
'taiwan': [121.5654, 25.0330],
'tw': [121.5654, 25.0330],
'united states': [-95.7129, 37.0902],
'us': [-95.7129, 37.0902],
'us seattle': [-122.3321, 47.6062],

View File

@@ -18,13 +18,18 @@ const enableExternalGeoLookup = process.env.ENABLE_EXTERNAL_GEO_LOOKUP === 'true
function normalizeGeo(geo) {
if (!geo) return geo;
// Custom normalization for TW, HK, MO to "China, {CODE}"
const specialRegions = ['TW'];
if (specialRegions.includes(geo.country?.toUpperCase())) {
// Custom normalization for TW to "Taipei, China" with Taipei coordinates
const country = (geo.country || geo.country_code || '').toUpperCase();
if (country === 'TW') {
return {
...geo,
city: `China, ${geo.country.toUpperCase()}`,
country_name: 'China'
city: 'Taipei',
country: 'TW',
country_name: 'China',
// Force Taipei coordinates for consistent 2D plotting
loc: '25.0330,121.5654',
latitude: 25.0330,
longitude: 121.5654
};
}
return geo;