优化中国台湾绘图
This commit is contained in:
@@ -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],
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user