科研 Skill
空间地理资料分析架构
spatial-data-architect
空間資料架構:地理編碼驗證、H3網格聚合、TWD97/WGS84座標紀律與空間自相關診斷、出版級地圖。用於不動產或區域研究的空間分析資料集。
SKILL.md
空間與地理資料分析架構師(Spatial Data Architect)
核心定位:家族缺的「空間那條線」
家族原本能處理面板、文字、多源,但沒有一支管「帶地理位置的資料」。本 skill 補上, 服務三類場景:
- 全台不動產 / hedonic 房價研究:實價登錄成交點 → 網格/行政區聚合 → 空間迴歸資料。
- 區域研究:公司總部地理定位、產業群聚、區域經濟變數的空間結構。
- 不動產事業應用:成交密度熱區圖、區域價格地圖——說服力強且可放簡報。
Step 1|座標系統(第一道、也最常被忽略的關卡)
台灣空間資料的頭號陷阱:
- WGS84(EPSG:4326):經緯度(度),Google Maps、GPS、多數 API 用。緯度 ~22-26、經度 ~120-122。
- TWD97 / TM2(EPSG:3826):投影座標(公尺),台灣官方圖資、部分政府資料用。數值是六、七位數的公尺。
- 鐵律:兩者不可混用;把 TWD97 的公尺數當經緯度餵進 H3/地圖,結果會完全錯位卻不報錯。
轉換用 pyproj(
Transformer.from_crs("EPSG:3826","EPSG:4326")),細節與台灣行政區代碼見references/taiwan-spatial-notes.md。本 skill 的聚合腳本內建 WGS84 範圍檢查,抓到投影座標會擋下。
Step 2|地理編碼 + 驗證退路(防 AI 幻覺座標)
地址→座標時,LLM 或線上地理編碼服務都會犯錯(同名地點、模糊地址、直接編一個)。
紀律(與 text-analytics 的 LLM 標註信效度同源,讀 references/geocoding-validation.md):
- 白名單/行政區約束:地址已知在某縣市,回傳座標必須落在該縣市界內,否則標記人工複核。
- 中心點/合理範圍檢查:座標落在台灣範圍外、或距該行政區中心過遠 → 離群,不自動採用。
- 抽樣人工核對:隨機抽 N 筆把座標貼回地圖看對不對,報一致率——這是資料品質的直接證據。
- 保留原始地址與來源:每個座標記
_geocoder與_asof(呼應 multi-source-data-integrator 的譜系)。 - 語言紀律:LLM 地理編碼是「輔助工具+人工驗證」,論文不寫「AI 定位了 X」。
- 接收別人的座標欄前先查編碼:經度正負號、度分秒打包成整數、網格資料的格點吸附、
地理編碼回空=失敗(要報失敗率並查是否集中在特定區域)。規則見
references/geocoding-validation.md「座標編碼與格點檢查」一節;公開 API 清單的 Geocoding 類多是 IP 定位,不是地址地理編碼。
Step 3|H3 六角網格聚合(比行政區更適合密度比較)
為什麼不直接用行政區:行政區面積差幾十倍,密度比較會被面積扭曲;H3 六角格面積相等、 鄰居距離一致、解析度可調,且個別地址被歸併到網格=天然去識別(隱私紅線)。
# 已實測腳本:點資料 → H3 網格聚合(含 WGS84 防線與筆數對帳)
python scripts/spatial_aggregate.py deals.csv --lat 緯度 --lng 經度 --value 成交價 --agg median --res 8
python scripts/spatial_aggregate.py # 無參數=跑內建自我測試
解析度選擇(台灣不動產):res 7≈邊長 1.2km(區域)、res 8≈0.5km(里級)、res 9≈0.2km(街廓)。
配方與 res 對照見 references/h3-aggregation-recipe.md。
隱私紅線:網格內筆數過小(如 n<3)可反推個別交易,畫圖與釋出前要遮罩或併格。
Step 4|空間計量意識(不越權,交棒 r-spss)
空間資料違反「觀測獨立」假設——鄰近的價格會互相影響。本 skill 負責診斷與資料準備, 估計交棒 r-spss-syntax-architect:
- 空間自相關:Moran's I 檢定殘差是否有空間結構(有=普通 OLS 標準誤失效)。
- 空間權重矩陣 W:鄰接(共邊)/距離帶/k 最近鄰;W 的選擇要理論化並做穩健性。
- 模型選擇:空間落後(SAR,外溢透過 Y)vs 空間誤差(SEM,外溢透過遺漏變數); 用 LM 檢定選型。hedonic 房價幾乎必然有空間自相關,純 OLS 會被審稿人打。
- 產出空間權重與診斷 → 交 r-spss(R 的 spdep/spatialreg)跑估計。
Step 5|出版級空間地圖(與 management-figure 分工)
本 skill 畫地理空間圖(有地理底圖/區界),management-figure 畫統計結果圖(無地圖)。
- choropleth 面量圖:行政區/網格著色表達數值(房價、密度)。
- hexbin 六角密度圖:H3 聚合結果直接上色,最適合成交密度熱區。
- 出圖配方(geopandas+matplotlib,色盲友善、TWD97 底圖對齊)見
references/spatial-figures-recipe.md。 - 誠實邊界:本 skill 產靜態出版級地圖(論文/簡報用);即時 3D/WebGL 互動視覺化 (Three.js/Mapbox 那種)不在範圍——那是前端工程,非研究方法。
家族接線
台灣官方統計來源(撈實價登錄/圖資)→ 各源清理 →
【本 skill】地理編碼驗證 + 座標統一 + H3 聚合 + 空間診斷 →
multi-source-data-integrator(與非空間變數合併)→
r-spss-syntax-architect(空間迴歸估計)→ 本 skill 出空間地圖 / management-figure 出統計圖 →
thesis-consistency-audit → q1-journal-reviewer
紅線
- 座標系統先確認再處理;TWD97 與 WGS84 不可混用,聚合前過範圍防線。
- 地理編碼一律驗證(行政區約束+離群檢查+抽樣核對);未驗證的座標不進最終資料。
- 隱私:個別地址歸併到網格;小樣本網格畫圖/釋出前遮罩,不建可反推個別交易的圖。
- 空間自相關要檢定;hedonic/區域研究用純 OLS 不處理空間依賴=方法硬傷,誠實揭露並轉空間模型。
- 本 skill 管空間資料準備、診斷、出地圖;實際迴歸估計交 r-spss,不越權宣稱已估計。
- 只產靜態出版級地圖;不假裝能做即時 3D 互動視覺化。
Limitations
- 本 skill 預設座標系統為台灣 TWD97/WGS84;處理其他國家資料時需自行換算對應 當地的官方座標系統與座標誤用防線,不可直接套用 TWD97 的 EPSG 代碼。
- 文中提到的「台灣官方統計來源」、
r-spss-syntax-architect、thesis-consistency-audit等姐妹 skill 未包含在本 marketplace 中;遇到相應步驟時直接套用本 skill 已說明的原則(座標驗證、H3 聚合、空間診斷)處理,不要嘗試呼叫不存在的 skill。management-figure(經管類 plugin)與q1-journal-reviewer(研究方法類 plugin) 則存在於本 marketplace 的其他 plugin 中,只有同時安裝對應 plugin 才能銜接。
示例提示词
我的数据有地址信息,想做地理编码验证和H3网格空间聚合分析。
所属插件
安装该插件会一并获得同领域的 58 个 Skill / MCP。
同插件的其他科研 Skill
- Mesa社会主体建模Builds Mesa agent-based models of opinion dynamics, segregation, social contagion, and network diffusion. Use when simulating emergent social behavior from agent rules.
- Mesa3主体建模引擎Builds agent-based models with the Mesa 3 AgentSet API, cell spaces, and batch_run sweeps for segregation, diffusion, and cooperation. Use for a Mesa 3.x ABM build or debug.
- 观察数据因果推断Estimates causal effects with DiD, IV, RDD, panel fixed effects, and propensity scores via statsmodels, linearmodels, DoWhy, and EconML. Use for observational or quasi-experimental causal estimation.
- 效应量元分析Pools effect sizes across studies with fixed/random-effects models, heterogeneity stats, forest/funnel plots, and publication-bias tests. Use for a systematic review’s quantitative synthesis.
- 缺失数据插补处理Handles missing data by naming the MCAR/MAR/MNAR mechanism, then applying multiple imputation (MICE) or FIML instead of single imputation. Use when a dataset has missing values to treat.
- 多层线性混合模型Fits mixed-effects/multilevel models (random slopes, ICC, GLMMs) for nested or longitudinal data via statsmodels, bambi, or R lme4/brms. Use for grouped data with within- vs between-cluster questions.
- 定性比较分析QCARuns crisp-, multi-value, and fuzzy-set Qualitative Comparative Analysis via R’s QCA package. Use for configurational or necessary/sufficient-condition research.
- 质性编码与主题分析Builds codebooks and computes intercoder reliability (Krippendorff’s alpha, kappa) for thematic or content coding, including human-vs-LLM double coding. Use when coding text or reporting reliability.
- 社会网络结构分析Computes network centrality, community detection, and ERGM inferential models matched to the research question via networkx/igraph. Use for social-network analysis beyond basic visualization.
- 社科研究设计把关Routes a study to its research design (experiment, quasi-experiment, observational, qualitative) and pins the identifying assumption first. Use when choosing a study design.
- 社科推论结论审核Audits inferential claims against the design before publication: unwarranted causal language, p-value/CI misreadings, and multiple-comparison issues. Use when checking a results section.
- 量表测量质量把关Checks that a scale’s reliability, validity, and measurement invariance are established before trusting or comparing it across groups. Use when adopting or reporting a survey instrument.
- 社科研究流程总控Coordinates a study through design, measurement, sampling, analysis, and inference gates with a shared Design Passport. Use for an end-to-end methodology review of a whole study.
- 质性研究可信度把关Gates qualitative trustworthiness before write-up: positionality, credibility, transferability, dependability, confirmability per Lincoln and Guba. Use before writing ethnographic findings.
- 抽样方法与样本量把关Checks that the sampling frame, method, and size match the inference paradigm before data collection. Use when planning recruitment or judging sample generalization.
- 复杂抽样调查分析Analyzes complex-sample survey data with design-based inference: weights, strata, PSUs, and calibration via Python svy or R survey/srvyr. Use for weighted surveys like GSS, ANES, or DHS.
- 文本数据定量分析Analyzes text as social-science data with topic modeling, embeddings, and validated dictionary or classification methods. Use for computational text analysis beyond a keyword count.
- 政策议题框架分析Runs anthropological framing and metaphor analysis on contested-policy documents, producing actor-attributed CSVs for NVivo import. Use for policy-framing or metaphor-analysis coding.
- 跨国比较政治分析Merges QoG, Polity5, and Freedom House data and runs cross-sectional OLS with fixed effects and regime classification. Use for comparative political-institution research.
- 计算社会学方法Covers social-media data collection, bot detection, network homophily, echo-chamber analysis, and conjoint survey experiments. Use for large-scale digital-trace sociology research.
- 冲突事件数据分析Downloads ACLED/UCDP conflict data and runs spatio-temporal clustering, conflict-onset logit panels, and fatality estimation. Use for quantitative armed-conflict research.
- 联合分析调查实验Designs conjoint survey experiments and estimates AMCEs via OLS, marginal means, and respondent-level heterogeneity. Use when designing or analyzing a choice-based conjoint experiment.
- 统计方法教学规范Defines the baseline statistical teaching and reproducibility standards shared across this analysis skill family. Use as the methodology reference other skills in the family build on.
- 人口统计方法分析Computes life tables, Leslie-matrix population projections, Lee-Carter mortality forecasts, and Kitagawa decomposition. Use for formal demographic analysis of mortality or population structure.
常见问题
空间地理资料分析架构能做什么?
空間資料架構:地理編碼驗證、H3網格聚合、TWD97/WGS84座標紀律與空間自相關診斷、出版級地圖。用於不動產或區域研究的空間分析資料集。
如何安装空间地理资料分析架构?
在科搭 Codar 左侧点击「插件」,在「组件」页签搜索「空间地理资料分析架构」并安装;在 Claude Code 或 Codex 中可以发送本页的安装提示词,或下载 Skill 包后解压到 ~/.claude/skills 或 ~/.codex/skills。
空间地理资料分析架构需要哪些权限?
该科研 Skill没有声明额外权限;执行具体操作时仍由 Agent 按自身规则请求确认。
空间地理资料分析架构经过官方审核吗?
是。SpeedSkills 收录的每个版本都会记录内容摘要与权限声明,当前版本已通过安全审核。