优化中国台湾绘图
This commit is contained in:
@@ -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