geospatial-analysis

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Geospatial Analysis

地理空间分析

Description

描述

Geospatial Analysis provides workflows for satellite imagery processing, GIS operations with GeoPandas, spatial statistics, and Earth observation data analysis. The agent builds reproducible geospatial pipelines that transform raw spatial data into actionable geographic intelligence, from raster processing through vector operations to publication-quality cartographic output.
Geospatial data is fundamentally different from tabular data: it has coordinate reference systems that must be respected, spatial relationships that affect statistical independence, and scale-dependent patterns that change with resolution. This skill encodes the domain knowledge needed to handle these challenges correctly: CRS transformations, spatial joins, buffer operations, raster-vector interoperability, and spatial autocorrelation tests.
The skill integrates satellite imagery analysis (Sentinel, Landsat) with vector data processing (shapefiles, GeoJSON), enabling workflows like land use classification from multispectral imagery, urban heat island analysis from thermal bands, and environmental change detection from temporal image stacks.
地理空间分析提供卫星影像处理、基于GeoPandas的GIS操作、空间统计以及对地观测数据分析的工作流。该Agent可构建可复现的地理空间管道,将原始空间数据转化为可落地的地理情报,涵盖从栅格处理、矢量操作到出版级制图输出的全流程。
地理空间数据与表格数据有着本质区别:它包含必须遵循的坐标参考系统(CRS)、影响统计独立性的空间关系,以及随分辨率变化的尺度依赖模式。本技能封装了正确处理这些挑战所需的领域知识:CRS转换、空间连接、缓冲区操作、栅格-矢量互操作性以及空间自相关检验。
本技能将卫星影像分析(Sentinel、Landsat)与矢量数据处理(shapefile、GeoJSON)相结合,支持多光谱影像土地利用分类、热波段城市热岛分析、时序影像栈环境变化检测等工作流。

Use When

使用场景

  • Processing satellite imagery (Sentinel-2, Landsat, MODIS)
  • Performing spatial joins, buffers, or overlay operations
  • Computing spatial statistics (Moran's I, hot spot analysis)
  • Creating publication-quality maps and cartographic outputs
  • Analyzing land use, land cover, or environmental change
  • Working with coordinate reference systems and projections
  • 处理卫星影像(Sentinel-2、Landsat、MODIS)
  • 执行空间连接、缓冲区或叠加操作
  • 计算空间统计量(Moran's I、热点分析)
  • 创建出版级地图与制图成果
  • 分析土地利用、土地覆盖或环境变化
  • 处理坐标参考系统与投影

How It Works

工作原理

mermaid
graph TD
    A[Spatial Data Input] --> B{Data Type}
    B -->|Raster| C[Satellite Imagery Processing]
    B -->|Vector| D[GeoPandas Operations]
    C --> E[Band Math + Indices: NDVI, NDWI]
    E --> F[Classification / Change Detection]
    D --> G[Spatial Joins + Overlay]
    G --> H[Spatial Statistics]
    F --> I[Raster-Vector Integration]
    H --> I
    I --> J[Cartographic Output]
    J --> K[Publication Map]
Raster and vector paths converge at the integration step, where classified imagery is combined with administrative boundaries, point observations, or infrastructure data to produce the final analytical product.
mermaid
graph TD
    A[Spatial Data Input] --> B{Data Type}
    B -->|Raster| C[Satellite Imagery Processing]
    B -->|Vector| D[GeoPandas Operations]
    C --> E[Band Math + Indices: NDVI, NDWI]
    E --> F[Classification / Change Detection]
    D --> G[Spatial Joins + Overlay]
    G --> H[Spatial Statistics]
    F --> I[Raster-Vector Integration]
    H --> I
    I --> J[Cartographic Output]
    J --> K[Publication Map]
栅格与矢量路径在集成步骤汇合,分类后的影像会与行政边界、点观测数据或基础设施数据结合,生成最终的分析成果。

Implementation

实现代码

python
import geopandas as gpd
import rasterio
from rasterio.mask import mask
from shapely.geometry import Point
import numpy as np
from pysal.explore import esda
from pysal.lib import weights
import matplotlib.pyplot as plt
import contextily as cx

def load_and_reproject(filepath: str, target_crs: str = "EPSG:4326") -> gpd.GeoDataFrame:
    gdf = gpd.read_file(filepath)
    return gdf.to_crs(target_crs)

def spatial_join_points_to_polygons(
    points: gpd.GeoDataFrame, polygons: gpd.GeoDataFrame
) -> gpd.GeoDataFrame:
    assert points.crs == polygons.crs, "CRS mismatch: reproject before joining"
    return gpd.sjoin(points, polygons, how="inner", predicate="within")

def compute_ndvi(nir_path: str, red_path: str) -> np.ndarray:
    with rasterio.open(nir_path) as nir_src, rasterio.open(red_path) as red_src:
        nir = nir_src.read(1).astype(np.float32)
        red = red_src.read(1).astype(np.float32)
    ndvi = np.where((nir + red) > 0, (nir - red) / (nir + red), 0)
    return ndvi

def spatial_autocorrelation(gdf: gpd.GeoDataFrame, column: str) -> dict:
    w = weights.Queen.from_dataframe(gdf)
    w.transform = "r"
    moran = esda.Moran(gdf[column], w)
    return {
        "morans_i": moran.I,
        "p_value": moran.p_sim,
        "z_score": moran.z_sim,
        "significant": moran.p_sim < 0.05,
        "interpretation": "Clustered" if moran.I > 0 and moran.p_sim < 0.05 else
                         "Dispersed" if moran.I < 0 and moran.p_sim < 0.05 else
                         "Random",
    }

def publication_map(gdf: gpd.GeoDataFrame, column: str, title: str, output: str):
    fig, ax = plt.subplots(1, 1, figsize=(10, 8))
    gdf.plot(column=column, ax=ax, legend=True, cmap="YlOrRd", edgecolor="0.5", linewidth=0.3)
    cx.add_basemap(ax, crs=gdf.crs.to_string(), source=cx.providers.CartoDB.Positron)
    ax.set_title(title, fontsize=14, fontweight="bold")
    ax.set_axis_off()
    fig.tight_layout()
    fig.savefig(output, dpi=300, bbox_inches="tight")
    plt.close(fig)
python
import geopandas as gpd
import rasterio
from rasterio.mask import mask
from shapely.geometry import Point
import numpy as np
from pysal.explore import esda
from pysal.lib import weights
import matplotlib.pyplot as plt
import contextily as cx

def load_and_reproject(filepath: str, target_crs: str = "EPSG:4326") -> gpd.GeoDataFrame:
    gdf = gpd.read_file(filepath)
    return gdf.to_crs(target_crs)

def spatial_join_points_to_polygons(
    points: gpd.GeoDataFrame, polygons: gpd.GeoDataFrame
) -> gpd.GeoDataFrame:
    assert points.crs == polygons.crs, "CRS mismatch: reproject before joining"
    return gpd.sjoin(points, polygons, how="inner", predicate="within")

def compute_ndvi(nir_path: str, red_path: str) -> np.ndarray:
    with rasterio.open(nir_path) as nir_src, rasterio.open(red_path) as red_src:
        nir = nir_src.read(1).astype(np.float32)
        red = red_src.read(1).astype(np.float32)
    ndvi = np.where((nir + red) > 0, (nir - red) / (nir + red), 0)
    return ndvi

def spatial_autocorrelation(gdf: gpd.GeoDataFrame, column: str) -> dict:
    w = weights.Queen.from_dataframe(gdf)
    w.transform = "r"
    moran = esda.Moran(gdf[column], w)
    return {
        "morans_i": moran.I,
        "p_value": moran.p_sim,
        "z_score": moran.z_sim,
        "significant": moran.p_sim < 0.05,
        "interpretation": "Clustered" if moran.I > 0 and moran.p_sim < 0.05 else
                         "Dispersed" if moran.I < 0 and moran.p_sim < 0.05 else
                         "Random",
    }

def publication_map(gdf: gpd.GeoDataFrame, column: str, title: str, output: str):
    fig, ax = plt.subplots(1, 1, figsize=(10, 8))
    gdf.plot(column=column, ax=ax, legend=True, cmap="YlOrRd", edgecolor="0.5", linewidth=0.3)
    cx.add_basemap(ax, crs=gdf.crs.to_string(), source=cx.providers.CartoDB.Positron)
    ax.set_title(title, fontsize=14, fontweight="bold")
    ax.set_axis_off()
    fig.tight_layout()
    fig.savefig(output, dpi=300, bbox_inches="tight")
    plt.close(fig)

Best Practices

最佳实践

  • Always verify CRS alignment before spatial operations—mismatched CRS produce silent errors
  • Use projected CRS (meters) for distance and area calculations, geographic CRS (degrees) for display
  • Apply Moran's I to test for spatial autocorrelation before using non-spatial statistics
  • Validate NDVI and other index ranges (NDVI should be -1 to 1) as a data quality check
  • Include scale bars, north arrows, and CRS labels on all published maps
  • Store geospatial data in GeoParquet for performance; use GeoJSON only for interchange
  • 在执行空间操作前始终验证CRS对齐——不匹配的CRS会产生无提示错误
  • 使用投影CRS(米单位)进行距离与面积计算,使用地理CRS(度单位)进行展示
  • 在使用非空间统计方法前,应用Moran's I检验空间自相关性
  • 验证NDVI及其他指数的范围(NDVI应在-1到1之间),作为数据质量检查手段
  • 在所有出版地图上包含比例尺、指北针和CRS标签
  • 使用GeoParquet存储地理空间数据以提升性能;仅在数据交换时使用GeoJSON

Platform Compatibility

平台兼容性

PlatformSupportNotes
CursorFullPython + geospatial libs
VS CodeFullJupyter + map rendering
WindsurfFullScientific Python
Claude CodeFullPipeline generation
ClineFullGIS workflows
aiderPartialCode generation only
平台支持情况说明
Cursor完全支持Python + 地理空间库
VS Code完全支持Jupyter + 地图渲染
Windsurf完全支持科学计算Python环境
Claude Code完全支持管道生成
Cline完全支持GIS工作流
aider部分支持仅代码生成

Related Skills

相关技能

  • Data Analysis
  • Machine Learning
  • Research Methodology
  • Batch Processing
  • 数据分析
  • 机器学习
  • 研究方法
  • 批处理

Keywords

关键词

geospatial
geopandas
satellite-imagery
ndvi
spatial-statistics
gis
rasterio
cartography
earth-observation

© 2026 googleadsagent.ai™ | Agent Skills™ | MIT License
geospatial
geopandas
satellite-imagery
ndvi
spatial-statistics
gis
rasterio
cartography
earth-observation

© 2026 googleadsagent.ai™ | Agent Skills™ | MIT License