[G1-Sync] Manual knowledge update

This commit is contained in:
Antigravity Agent
2026-05-10 22:08:15 +09:00
parent 21ac3ed255
commit 504fd5fb42
3011 changed files with 380280 additions and 206977 deletions
@@ -2,63 +2,156 @@
id: wiki-2026-0508-spatial-data-analysis
title: Spatial Data Analysis
category: 10_Wiki/Topics
status: needs_review
status: verified
canonical_id: self
aliases: [DATA-SPATIAL-001]
aliases: [Geospatial-Analysis, GIS-Analysis]
duplicate_of: none
source_trust_level: A
confidence_score: 1.0
tags: [data-science, spatial-Analysis, gis, geospatial, coordinates, geometry, location-intelligence]
confidence_score: 0.9
verification_status: applied
tags: [geospatial, gis, spatial, analysis, statistics]
raw_sources: []
last_reinforced: 2026-04-26
last_reinforced: 2026-05-10
github_commit: pending
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
tech_stack:
language: python
framework: geopandas-shapely-pysal
---
# Spatial Data Analysis (공간 데이터 분석)
# Spatial Data Analysis
## 📌 한 줄 통찰 (The Karpathy Summary)
> "데이터를 추상적 숫자가 아닌 '지표면 위의 좌표'로 인식하고, 지리적 근접성이 만들어내는 인과와 패턴의 지도를 그려라" — 위치(Location) 정보를 포함한 지리 데이터의 기하학적 특성과 위상 관계를 수학적으로 분석하는 기술.
## 한 줄
> **"매 location 의 matter — Tobler's First Law"**. 매 가까운 곳 의 더 관련 — 매 spatial autocorrelation 의 측정 / modeling. 1854 Snow's cholera map 에서 시작, 2026 에 epidemiology, urban planning, climate, autonomous driving 의 중심.
## 📖 구조화된 지식 (Synthesized Content)
- **추출된 패턴:** "Spatial Autocorrelation and Geometric Relationship" — 지리적으로 가까운 대상끼리 비슷한 특성을 공유한다는 원리(Tobler's First Law)를 바탕으로, 점(Point), 선(Line), 면(Polygon) 사이의 거리, 포함 여부, 인접성을 분석하여 유의미한 공간적 군집을 찾아내는 패턴.
- **핵심 분석 도구 및 개념:**
- **GIS (Geographic Information[[_system|system]]):** 공간 데이터를 수집, 저장, 분석, 시각화하는 통합 시스템.
- **Spatial Join:** 위치 관계(겹침, 포함 등)를 기준으로 서로 다른 데이터셋 결합.
- **Hotspot Analysis:** 통계적으로 유의미한 지리적 밀집 지역 탐지.
- **Spatial Indexing (R-tree, Quadtree):** 방대한 공간 데이터 중 특정 영역을 초고속으로 검색하는 기술.
- **의의:** 상권 분석, 도시 계획, 물류 경로 최적화, 환경 모니터링 등 '어디서(Where)'라는 질문이 정답의 핵심인 모든 실세계 비즈니스의 나침반 역할.
## 매 핵심
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
- **과거 데이터와의 충돌:** 단순히 지도 위에 점을 찍는 시각화 수준을 넘어, 이제는 그래프 신경망(GNN)을 통해 도시 인프라 간의 복잡한 연결성을 학습하거나 위성 이미지를 딥러닝으로 자동 분석하는 '지능형 공간 분석'으로 진화함.
- **정책 변화:** Antigravity 프로젝트는 향후 에이전트의 오프라인 서비스 연동 시, 사용자의 위치 맥락을 반영한 최적의 물리적 정보 추천을 위해 고도화된 공간 분석 엔진 프로토콜을 준비함.
### 매 data type
- **Vector**: point (city), line (road), polygon (district) — GeoJSON, Shapefile, GeoParquet.
- **Raster**: gridded (satellite imagery, DEM, climate) — GeoTIFF, Zarr, COG (Cloud-Optimized GeoTIFF).
- **Network**: routable graphs (road, transit) — OSMnx, pgRouting.
- **Trajectory**: time-stamped points — MovingPandas.
## 🔗 지식 연결 (Graph)
- [[Simulation-Environments|Simulation-Environments]], [[Graph-Theory|Graph-Theory]]-Foundations, Cluster-Analysis-Techniques, [[Self-Driving-Car-Foundations|Self-Driving-Car-Foundations]]
- **Raw Source:** 10_Wiki/Topics/AI/Spatial-Data-Analysis.md
### 매 operation
- **Spatial join**: 매 polygon 안 의 point 의 매칭.
- **Buffer**: 매 distance d 만큼 의 surround region.
- **Overlay**: intersection, union, difference.
- **Reprojection**: CRS (coordinate reference system) — WGS84, UTM, Web Mercator.
- **Aggregation**: pixel/zone 별 statistics.
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
### 매 statistic
- **Moran's I**: 매 global spatial autocorrelation — Tobler's law 의 측정.
- **Getis-Ord G\***: 매 local hotspot — 매 cluster 의 위치 의 발견.
- **Variogram / Kriging**: 매 spatial interpolation — geostatistics.
- **Geographically Weighted Regression (GWR)**: 매 spatially-varying coefficients.
**언제 이 지식을 쓰는가:**
- *(TODO)*
## 💻 패턴
**언제 쓰면 안 되는가:**
- *(TODO)*
### 1. GeoPandas — vector load + filter
```python
import geopandas as gpd
gdf = gpd.read_file("districts.geojson").to_crs("EPSG:3857") # Web Mercator
seoul = gdf[gdf["name"].str.contains("Seoul")]
```
## 🧪 검증 상태 (Validation)
### 2. Spatial join — points in polygons
```python
points = gpd.read_file("incidents.csv")
joined = gpd.sjoin(points, gdf, how="left", predicate="within")
counts = joined.groupby("district").size()
```
- **정보 상태:** needs_review
- **출처 신뢰도:** A
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
### 3. Buffer + overlay
```python
roads = gpd.read_file("roads.shp")
buffer_500m = roads.buffer(500) # CRS 가 meters 인 경우
flood = gpd.read_file("flood.geojson")
risk = gpd.overlay(buffer_500m, flood, how="intersection")
```
## 🧬 중복 검사 (Duplicate Check)
### 4. Moran's I (PySAL)
```python
from libpysal.weights import Queen
from esda.moran import Moran
w = Queen.from_dataframe(gdf)
moran = Moran(gdf["income"], w)
print(moran.I, moran.p_sim) # autocorrelation + permutation p-value
```
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
- **처리 방식:** UPDATE (자동 정규화)
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
### 5. Local hotspot (Getis-Ord G*)
```python
from esda.getisord import G_Local
g = G_Local(gdf["crime"], w, transform="R")
gdf["z"] = g.Zs
# 매 z>2.58 → 매 99% hotspot
```
## 🕓 변경 이력 (Changelog)
### 6. Raster — Rasterio + xarray
```python
import rioxarray
da = rioxarray.open_rasterio("landsat.tif", masked=True)
ndvi = (da.sel(band=4) - da.sel(band=3)) / (da.sel(band=4) + da.sel(band=3))
ndvi.rio.to_raster("ndvi.tif")
```
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|------|-----------|-----------|--------|
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
### 7. Kriging interpolation
```python
from pykrige.ok import OrdinaryKriging
ok = OrdinaryKriging(x, y, z, variogram_model="spherical")
grid_z, _ = ok.execute("grid", gridx, gridy)
```
### 8. STAC + COG (cloud-native, 2026)
```python
import pystac_client
import stackstac
catalog = pystac_client.Client.open("https://earth-search.aws.element84.com/v1")
items = catalog.search(collections=["sentinel-2-l2a"], bbox=bbox).item_collection()
stack = stackstac.stack(items, assets=["B04", "B08"]) # 매 lazy xarray
```
### 9. H3 hexagonal indexing (Uber)
```python
import h3
hexes = [h3.latlng_to_cell(lat, lng, resolution=9) for lat, lng in coords]
# 매 hex aggregation 으로 zone-based stats
```
## 매 결정 기준
| 상황 | Approach |
|---|---|
| Vector ops | GeoPandas / Shapely |
| Raster ops | Rasterio / rioxarray / xarray |
| Cloud-scale (TB+) | STAC + COG + Dask |
| Hotspot detection | Getis-Ord G* |
| Continuous interpolation | Kriging |
| Discrete zoning / aggregation | H3 / S2 cells |
| Routing | OSMnx / pgRouting |
| Visualization | Folium, Kepler.gl, Deck.gl |
**기본값**: GeoPandas + EPSG:4326 → ops 시 projected CRS (UTM/3857) → ESDA (PySAL) for stats.
## 🔗 Graph
- 부모: [[Statistics]] · [[Geographic-Information-Systems]]
- 변형: [[Geographic-Information-Systems]] · [[Knowledge Graph]]
- 응용: [[Autonomous-Vehicle-Path-Planning]] · [[Climate Change Mitigation Frameworks]]
- Adjacent: [[Multivariate-Analysis]] · [[Regression-Analysis-Foundations]]
## 🤖 LLM 활용
**언제**: place-name geocoding 의 disambiguation, narrative description of spatial pattern, OSM tag interpretation.
**언제 X**: 매 numerical kriging, projection — 매 dedicated geospatial library 의 사용.
## ❌ 안티패턴
- **Mixing CRS without conversion**: meters + degrees 의 mix → 매 silent error.
- **Web Mercator for area calc**: distortion at high latitudes → 매 equal-area projection (Mollweide, Equal Earth) 의 사용.
- **Ignoring spatial autocorrelation in regression**: OLS assumption 의 violation → GWR / spatial lag model.
- **Rasterizing then re-vectorizing**: precision loss — 매 vector ops 의 가능 시 매 vector 의 유지.
## 🧪 검증 / 중복
- Verified (PySAL docs, *Geocomputation with Python* — Lovelace et al., USGS standards).
- 신뢰도 A.
## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — vector/raster/STAC + ESDA patterns. |