Skip to content

Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.

feat(geocoding): 更新城市信息提取优先级以适配中国行政区划

Timothy Yin2a8d424daf18
diff --git a/server/services/location/geocoding.ts b/server/services/location/geocoding.ts
index 4324b107..7513d4f9 100644
--- a/server/services/location/geocoding.ts
+++ b/server/services/location/geocoding.ts
@@ -57,14 +57,16 @@ class NominatimGeocodingProvider implements GeocodingProvider {
// 提取国家信息
const country = address.country || address.country_code?.toUpperCase()
- // 提取城市信息(优先级:state > city > town > village > hamlet)
+ // 提取城市信息(优先级:district > city > town > county > state > village > hamlet)
+ // 适配中国行政区划
const city =
- address.state ||
+ address.district ||
address.city ||
address.town ||
+ address.county ||
+ address.state ||
address.village ||
- address.hamlet ||
- address.county
+ address.hamlet
// 构建位置名称
const locationName = data.display_name