归属判定升级:DataV 官方行政区划表 + 同名县消歧

用阿里 DataV GeoAtlas(免密钥)替换 OSM Overpass 离线县表:
- 民政部 adcode 体系,县级前 4 位即所属地级码,2832 县 100% 可定位地级
  (OSM 表只有 1182/2362,且 admin_level 层级不可靠)
- 同名县(全国 30 组)保留全部候选,运行时按坐标消歧,
  修掉「柳州的城中区被归到西宁市」

归属判定改为「按名字精确查官方表」优先于「按中心点猜最近的县」:
窄长县按中心点会跨省错判(环江喀斯特实际在环江县,按中心点判到荔波县)
查表带距离校验,精确全称命中放宽到 150km(狭长县中心离边界可达 85km+)

修掉三个真实缺陷:
- Overpass 兜底把地级塞进 osmCounty、县名塞进 osmCity,
  与 attachPlaces「先找县级」的顺序相反,导致兜底路径永远丢下层县名
- Overpass 请求无硬超时,公共实例「连着不返回」能把一次分析拖成十几分钟;
  补三层限(单次超时 / 阶段总时限 / is_in 反查次数上限),13 分钟 → 48 秒
- Photon 的 osm.place.city 类目混着景点 POI,kind==='城市' 时无条件把名字
  当地名,导致「社更穿洞北门」「柳州之门」等景点自己成一组;
  改为必须同时是行政区名且能在官方表查到

新增离线回归测试(都不打外部网络,Photon/Overpass 挂掉也能回归):
- test-admin-lookup:同名县消歧、已知边界点、狭长县远端点(19 项)
- test-overpass-fallback:本地假 Overpass,验兜底路径、简称归一、200+HTML 错误页
- test-grouping-regression:本地假 Photon,20 候选完整分组
- verify-ui-full:端到端 UI 验收(真实无头 Chrome 读真实 DOM)
This commit is contained in:
2026-11-06 02:05:24 +08:00
parent c5c2ffae68
commit 7ad86c6619
25 changed files with 2766 additions and 13 deletions
+61
View File
@@ -691,6 +691,67 @@ input[type="range"] { width: 100%; accent-color: var(--accent); }
/* 两张卡内容长度差很多,按 start 对齐,别互相拉伸 */
.plan-extra { align-items: start; }
/* ------------------------------------------------- 第二步:搜索 + 地名分组 */
.search-box { position: relative; display: flex; align-items: center; }
.search-box input[type="search"] {
width: 230px; padding: 7px 30px 7px 11px;
border: 1px solid var(--rule-strong); border-radius: 8px;
background: var(--sheet); color: var(--ink); font-size: 12.5px;
transition: border-color .15s, box-shadow .15s;
}
.search-box input[type="search"]::-webkit-search-cancel-button { display: none; }
.search-box input[type="search"]::placeholder { color: var(--muted); }
.search-box input[type="search"]:focus {
outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 111, 237, .12);
}
.search-clear {
position: absolute; right: 6px; border: 0; background: transparent;
color: var(--muted); font-size: 13px; line-height: 1; padding: 3px 5px; border-radius: 5px;
}
.search-clear:hover { background: var(--paper-2); color: var(--ink); }
/* 筛选提示条:告诉用户「当前显示多少 / 共多少」以及生效了哪些条件 */
.filter-note {
font-family: var(--mono); font-size: 11.5px; color: var(--ink-soft);
background: var(--sheet-2); border: 1px solid var(--rule); border-left: 3px solid var(--accent);
border-radius: 8px; padding: 8px 12px; margin-bottom: 14px; line-height: 1.7;
}
.filter-note b { color: var(--accent); font-weight: 700; }
/* 地名分组:组标题是按钮,下面缩进放景点卡片 */
.cards.has-groups { display: block; }
.place-group { margin-bottom: 22px; }
.place-head {
display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap;
width: 100%; text-align: left; padding: 9px 12px; margin-bottom: 12px;
background: var(--sheet-2); border: 1px solid var(--rule-strong); border-left: 4px solid var(--accent);
border-radius: 8px; transition: .15s ease;
}
.place-head:hover { background: var(--accent-soft); border-color: var(--accent); }
.place-caret { color: var(--accent); font-size: 11px; flex: 0 0 auto; }
.place-name { font-family: var(--serif); font-size: 16px; font-weight: 700; color: var(--ink); }
.place-detail {
font-size: 11.5px; color: var(--ink-soft); background: var(--sheet);
border: 1px solid var(--rule); border-radius: 999px; padding: 2px 9px;
}
.place-meta {
margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--muted);
white-space: nowrap;
}
.place-items {
display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px;
align-items: start; padding-left: 16px; border-left: 2px dashed var(--rule-strong);
margin-left: 6px;
}
.place-items.collapsed { display: none; }
@media (max-width: 720px) {
.search-box input[type="search"] { width: 100%; }
.search-box { flex: 1 1 100%; }
.place-items { grid-template-columns: 1fr; padding-left: 10px; }
.place-meta { margin-left: 0; width: 100%; }
}
@media (max-width: 900px) {
.plan-extra { grid-template-columns: 1fr; }
}