跳到主要内容
SkillVault logo SkillVault
免费 ChatGPT GPTs Claude Code Cursor

geopandas

Python library for working with geospatial vector data including shapefiles, GeoJSON, and GeoPackage files. Use when working with geographic data for spatial analysis, geometric operations, coordinate transformations, spatial joins, overlay operations, choropleth mapping, or any task involving reading/writing/analyzing vector geographic data. Supports PostGIS databases, interactive maps, and integration with matplotlib/folium/cartopy. Use for tasks like buffer analysis, spatial joins between datasets, dissolving boundaries, clipping data, calculating areas/distances, reprojecting coordinate systems, creating maps, or converting between spatial file formats.

0 次下载 0 次浏览 更新于 Oct 31, 2026 v1.0.0
geopandas skill cover

下方技能配置(提示词、变量、安装步骤)保留英文原文。.aiskill 文件直接面向 AI 智能体,统一使用英文以确保跨平台行为一致。

概述

Python library for working with geospatial vector data including shapefiles, GeoJSON, and GeoPackage files. Use when working with geographic data for spatial analysis, geometric operations, coordinate transformations, spatial joins, overlay operations, choropleth mapping, or any task involving reading/writing/analyzing vector geographic data. Supports PostGIS databases, interactive maps, and integration with matplotlib/folium/cartopy. Use for tasks like buffer analysis, spatial joins between datasets, dissolving boundaries, clipping data, calculating areas/distances, reprojecting coordinate systems, creating maps, or converting between spatial file formats.

Source: https://github.com/DenDen047/claude-scientific-skills · BSD-3-CLAUSE LICENSE · © 2025 K-Dense Inc.

系统提示词

定义智能体角色、规则与输出格式的指令块。

system-prompt.txt
# GeoPandas

GeoPandas extends pandas to enable spatial operations on geometric types. It combines the capabilities of pandas and shapely for geospatial data analysis.

## Installation

```bash
uv pip install geopandas
```

### Optional Dependencies

```bash
# For interactive maps
uv pip install folium

# For classification schemes in mapping
uv pip install mapclassify

# For faster I/O operations (2-4x speedup)
uv pip install pyarrow

# For PostGIS database support
uv pip install psycopg2
uv pip install geoalchemy2

# For basemaps
uv pip install contextily

# For cartographic projections
uv pip install cartopy
```

## Quick Start

```python
import geopandas as gpd

# Read spatial data
gdf = gpd.read_file("data.geojson")

# Basic exploration
print(gdf.head())
print(gdf.crs)
print(gdf.geometry.geom_type)

# Simple plot
gdf.plot()

# Reproject to different CRS
gdf_projected = gdf.to_crs("EPSG:3857")

# Calculate area (use projected CRS for accuracy)
gdf_projected['area'] = gdf_projected.geometry.area

# Save to file
gdf.to_file("output.gpkg")
```

## Core Concepts

### Data Structures

- **GeoSeries**: Vector of geometries with spatial operations
- **GeoDataFrame**: Tabular data structure with geometry column

See [data-structures.md](references/data-structures.md) for details.

### Reading and Writing Data

GeoPandas reads/writes multiple formats: Shapefile, GeoJSON, GeoPackage, PostGIS, Parquet.

```python
# Read with filtering
gdf = gpd.read_file("data.gpkg", bbox=(xmin, ymin, xmax, ymax))

# Write with Arrow acceleration
gdf.to_file("output.gpkg", use_arrow=True)
```

See [data-io.md](references/data-io.md) for comprehensive I/O operations.

### Coordinate Reference Systems

Always check and manage CRS for accurate spatial operations:

```python
# Check CRS
print(gdf.crs)

# Reproject (transforms coordinates)
gdf_projected = gdf.to_crs("EPSG:3857")

# Set CRS (only when metadata missing)
gdf = gdf.set_crs("EPSG:4326")
```

See [crs-management.md](references/crs-management.md) for CRS operations.

## Common Operations

### Geometric Operations

Buffer, simplify, centroid, convex hull, affine transformations:

```python
# Buffer by 10 units
buffered = gdf.geometry.buffer(10)

# Simplify with tolerance
simplified = gdf.geometry.simplify(tolerance=5, preserve_topology=True)

# Get centroids
centroids = gdf.geometry.centroid
```

See [geometric-operations.md](references/geometric-operations.md) for all operations.

### Spatial Analysis

Spatial joins, overlay operations, dissolve:

```python
# Spatial join (intersects)
joined = gpd.sjoin(gdf1, gdf2, predicate='intersects')

# Nearest neighbor join
nearest = gpd.sjoin_nearest(gdf1, gdf2, max_distance=1000)

# Overlay intersection
intersection = gpd.overlay(gdf1, gdf2, how='intersection')

# Dissolve by attribute
dissolved = gdf.dissolve(by='region', aggfunc='sum')
```

See [spatial-analysis.md](references/spatial-analysis.md) for analysis operations.

### Visualization

Create static and interactive maps:

```python
# Choropleth map
gdf.plot(column='population', cmap='YlOrRd', legend=True)

# Interactive map
gdf.explore(column='population', legend=True).save('map.html')

# Multi-layer map
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
gdf1.plot(ax=ax, color='blue')
gdf2.plot(ax=ax, color='red')
```

See [visualization.md](references/visualization.md) for mapping techniques.

## Detailed Documentation

- **[Data Structures](references/data-structures.md)** - GeoSeries and GeoDataFrame fundamentals
- **[Data I/O](references/data-io.md)** - Reading/writing files, PostGIS, Parquet
- **[Geometric Operations](references/geometric-operations.md)** - Buffer, simplify, affine transforms
- **[Spatial Analysis](references/spatial-analysis.md)** - Joins, overlay, dissolve, clipping
- **[Visualization](references/visualization.md)** - Plotting, choropleth maps, interactive maps
- **[CRS Management](references/crs-management.md)** - Coordinate reference systems and projections

## Common Workflows

### Load, Transform, Analyze, Export

```python
# 1. Load data
gdf = gpd.read_file("data.shp")

# 2. Check and transform CRS
print(gdf.crs)
gdf = gdf.to_crs("EPSG:3857")

# 3. Perform analysis
gdf['area'] = gdf.geometry.area
buffered = gdf.copy()
buffered['geometry'] = gdf.geometry.buffer(100)

# 4. Export results
gdf.to_file("results.gpkg", layer='original')
buffered.to_file("results.gpkg", layer='buffered')
```

### Spatial Join and Aggregate

```python
# Join points to polygons
points_in_polygons = gpd.sjoin(points_gdf, polygons_gdf, predicate='within')

# Aggregate by polygon
aggregated = points_in_polygons.groupby('index_right').agg({
    'value': 'sum',
    'count': 'size'
})

# Merge back to polygons
result = polygons_gdf.merge(aggregated, left_index=True, right_index=True)
```

### Multi-Source Data Integration

```python
# Read from different sources
roads = gpd.read_file("roads.shp")
buildings = gpd.read_file("buildings.geojson")
parcels = gpd.read_postgis("SELECT * FROM parcels", con=engine, geom_col='geom')

# Ensure matching CRS
buildings = buildings.to_crs(roads.crs)
parcels = parcels.to_crs(roads.crs)

# Perform spatial operations
buildings_near_roads = buildings[buildings.geometry.distance(roads.union_all()) < 50]
```

## Performance Tips

1. **Use spatial indexing**: GeoPandas creates spatial indexes automatically for most operations
2. **Filter during read**: Use `bbox`, `mask`, or `where` parameters to load only needed data
3. **Use Arrow for I/O**: Add `use_arrow=True` for 2-4x faster reading/writing
4. **Simplify geometries**: Use `.simplify()` to reduce complexity when precision isn't critical
5. **Batch operations**: Vectorized operations are much faster than iterating rows
6. **Use appropriate CRS**: Projected CRS for area/distance, geographic for visualization

## Best Practices

1. **Always check CRS** before spatial operations
2. **Use projected CRS** for area and distance calculations
3. **Match CRS** before spatial joins or overlays
4. **Validate geometries** with `.is_valid` before operations
5. **Use `.copy()`** when modifying geometry columns to avoid side effects
6. **Preserve topology** when simplifying for analysis
7. **Use GeoPackage** format for modern workflows (better than Shapefile)
8. **Set max_distance** in sjoin_nearest for better performance

用户提示词模板

填充变量后发送,即可运行该技能: {{variables}}

user-template.txt

变量

名称 必填 说明 示例

完整技能配置

标准 .aiskill 文件,提供 JSON 与 YAML 两种格式。

geopandas.aiskill (JSON)
{
  "format": "aiskill/v1",
  "skill": {
    "name": "geopandas",
    "slug": "geopandas",
    "version": "1.0.0",
    "description": "Python library for working with geospatial vector data including shapefiles, GeoJSON, and GeoPackage files. Use when working with geographic data for spatial analysis, geometric operations, coordinate transformations, spatial joins, overlay operations, choropleth mapping, or any task involving reading/writing/analyzing vector geographic data. Supports PostGIS databases, interactive maps, and integration with matplotlib/folium/cartopy. Use for tasks like buffer analysis, spatial joins between datasets, dissolving boundaries, clipping data, calculating areas/distances, reprojecting coordinate systems, creating maps, or converting between spatial file formats.",
    "category": "Research",
    "tags": [
      "research-science",
      "sql",
      "content",
      "python"
    ],
    "platforms": [
      "chatgpt",
      "claude-code",
      "cursor"
    ],
    "tested_environment": "Agent Skills convention (SKILL.md) — works with Claude Code, Cursor, ChatGPT/Codex and compatible agents",
    "license": "BSD-3-CLAUSE LICENSE"
  },
  "prompts": {
    "system": "# GeoPandas\r\n\r\nGeoPandas extends pandas to enable spatial operations on geometric types. It combines the capabilities of pandas and shapely for geospatial data analysis.\r\n\r\n## Installation\r\n\r\n```bash\r\nuv pip install geopandas\r\n```\r\n\r\n### Optional Dependencies\r\n\r\n```bash\r\n# For interactive maps\r\nuv pip install folium\r\n\r\n# For classification schemes in mapping\r\nuv pip install mapclassify\r\n\r\n# For faster I/O operations (2-4x speedup)\r\nuv pip install pyarrow\r\n\r\n# For PostGIS database support\r\nuv pip install psycopg2\r\nuv pip install geoalchemy2\r\n\r\n# For basemaps\r\nuv pip install contextily\r\n\r\n# For cartographic projections\r\nuv pip install cartopy\r\n```\r\n\r\n## Quick Start\r\n\r\n```python\r\nimport geopandas as gpd\r\n\r\n# Read spatial data\r\ngdf = gpd.read_file(\"data.geojson\")\r\n\r\n# Basic exploration\r\nprint(gdf.head())\r\nprint(gdf.crs)\r\nprint(gdf.geometry.geom_type)\r\n\r\n# Simple plot\r\ngdf.plot()\r\n\r\n# Reproject to different CRS\r\ngdf_projected = gdf.to_crs(\"EPSG:3857\")\r\n\r\n# Calculate area (use projected CRS for accuracy)\r\ngdf_projected['area'] = gdf_projected.geometry.area\r\n\r\n# Save to file\r\ngdf.to_file(\"output.gpkg\")\r\n```\r\n\r\n## Core Concepts\r\n\r\n### Data Structures\r\n\r\n- **GeoSeries**: Vector of geometries with spatial operations\r\n- **GeoDataFrame**: Tabular data structure with geometry column\r\n\r\nSee [data-structures.md](references/data-structures.md) for details.\r\n\r\n### Reading and Writing Data\r\n\r\nGeoPandas reads/writes multiple formats: Shapefile, GeoJSON, GeoPackage, PostGIS, Parquet.\r\n\r\n```python\r\n# Read with filtering\r\ngdf = gpd.read_file(\"data.gpkg\", bbox=(xmin, ymin, xmax, ymax))\r\n\r\n# Write with Arrow acceleration\r\ngdf.to_file(\"output.gpkg\", use_arrow=True)\r\n```\r\n\r\nSee [data-io.md](references/data-io.md) for comprehensive I/O operations.\r\n\r\n### Coordinate Reference Systems\r\n\r\nAlways check and manage CRS for accurate spatial operations:\r\n\r\n```python\r\n# Check CRS\r\nprint(gdf.crs)\r\n\r\n# Reproject (transforms coordinates)\r\ngdf_projected = gdf.to_crs(\"EPSG:3857\")\r\n\r\n# Set CRS (only when metadata missing)\r\ngdf = gdf.set_crs(\"EPSG:4326\")\r\n```\r\n\r\nSee [crs-management.md](references/crs-management.md) for CRS operations.\r\n\r\n## Common Operations\r\n\r\n### Geometric Operations\r\n\r\nBuffer, simplify, centroid, convex hull, affine transformations:\r\n\r\n```python\r\n# Buffer by 10 units\r\nbuffered = gdf.geometry.buffer(10)\r\n\r\n# Simplify with tolerance\r\nsimplified = gdf.geometry.simplify(tolerance=5, preserve_topology=True)\r\n\r\n# Get centroids\r\ncentroids = gdf.geometry.centroid\r\n```\r\n\r\nSee [geometric-operations.md](references/geometric-operations.md) for all operations.\r\n\r\n### Spatial Analysis\r\n\r\nSpatial joins, overlay operations, dissolve:\r\n\r\n```python\r\n# Spatial join (intersects)\r\njoined = gpd.sjoin(gdf1, gdf2, predicate='intersects')\r\n\r\n# Nearest neighbor join\r\nnearest = gpd.sjoin_nearest(gdf1, gdf2, max_distance=1000)\r\n\r\n# Overlay intersection\r\nintersection = gpd.overlay(gdf1, gdf2, how='intersection')\r\n\r\n# Dissolve by attribute\r\ndissolved = gdf.dissolve(by='region', aggfunc='sum')\r\n```\r\n\r\nSee [spatial-analysis.md](references/spatial-analysis.md) for analysis operations.\r\n\r\n### Visualization\r\n\r\nCreate static and interactive maps:\r\n\r\n```python\r\n# Choropleth map\r\ngdf.plot(column='population', cmap='YlOrRd', legend=True)\r\n\r\n# Interactive map\r\ngdf.explore(column='population', legend=True).save('map.html')\r\n\r\n# Multi-layer map\r\nimport matplotlib.pyplot as plt\r\nfig, ax = plt.subplots()\r\ngdf1.plot(ax=ax, color='blue')\r\ngdf2.plot(ax=ax, color='red')\r\n```\r\n\r\nSee [visualization.md](references/visualization.md) for mapping techniques.\r\n\r\n## Detailed Documentation\r\n\r\n- **[Data Structures](references/data-structures.md)** - GeoSeries and GeoDataFrame fundamentals\r\n- **[Data I/O](references/data-io.md)** - Reading/writing files, PostGIS, Parquet\r\n- **[Geometric Operations](references/geometric-operations.md)** - Buffer, simplify, affine transforms\r\n- **[Spatial Analysis](references/spatial-analysis.md)** - Joins, overlay, dissolve, clipping\r\n- **[Visualization](references/visualization.md)** - Plotting, choropleth maps, interactive maps\r\n- **[CRS Management](references/crs-management.md)** - Coordinate reference systems and projections\r\n\r\n## Common Workflows\r\n\r\n### Load, Transform, Analyze, Export\r\n\r\n```python\r\n# 1. Load data\r\ngdf = gpd.read_file(\"data.shp\")\r\n\r\n# 2. Check and transform CRS\r\nprint(gdf.crs)\r\ngdf = gdf.to_crs(\"EPSG:3857\")\r\n\r\n# 3. Perform analysis\r\ngdf['area'] = gdf.geometry.area\r\nbuffered = gdf.copy()\r\nbuffered['geometry'] = gdf.geometry.buffer(100)\r\n\r\n# 4. Export results\r\ngdf.to_file(\"results.gpkg\", layer='original')\r\nbuffered.to_file(\"results.gpkg\", layer='buffered')\r\n```\r\n\r\n### Spatial Join and Aggregate\r\n\r\n```python\r\n# Join points to polygons\r\npoints_in_polygons = gpd.sjoin(points_gdf, polygons_gdf, predicate='within')\r\n\r\n# Aggregate by polygon\r\naggregated = points_in_polygons.groupby('index_right').agg({\r\n    'value': 'sum',\r\n    'count': 'size'\r\n})\r\n\r\n# Merge back to polygons\r\nresult = polygons_gdf.merge(aggregated, left_index=True, right_index=True)\r\n```\r\n\r\n### Multi-Source Data Integration\r\n\r\n```python\r\n# Read from different sources\r\nroads = gpd.read_file(\"roads.shp\")\r\nbuildings = gpd.read_file(\"buildings.geojson\")\r\nparcels = gpd.read_postgis(\"SELECT * FROM parcels\", con=engine, geom_col='geom')\r\n\r\n# Ensure matching CRS\r\nbuildings = buildings.to_crs(roads.crs)\r\nparcels = parcels.to_crs(roads.crs)\r\n\r\n# Perform spatial operations\r\nbuildings_near_roads = buildings[buildings.geometry.distance(roads.union_all()) < 50]\r\n```\r\n\r\n## Performance Tips\r\n\r\n1. **Use spatial indexing**: GeoPandas creates spatial indexes automatically for most operations\r\n2. **Filter during read**: Use `bbox`, `mask`, or `where` parameters to load only needed data\r\n3. **Use Arrow for I/O**: Add `use_arrow=True` for 2-4x faster reading/writing\r\n4. **Simplify geometries**: Use `.simplify()` to reduce complexity when precision isn't critical\r\n5. **Batch operations**: Vectorized operations are much faster than iterating rows\r\n6. **Use appropriate CRS**: Projected CRS for area/distance, geographic for visualization\r\n\r\n## Best Practices\r\n\r\n1. **Always check CRS** before spatial operations\r\n2. **Use projected CRS** for area and distance calculations\r\n3. **Match CRS** before spatial joins or overlays\r\n4. **Validate geometries** with `.is_valid` before operations\r\n5. **Use `.copy()`** when modifying geometry columns to avoid side effects\r\n6. **Preserve topology** when simplifying for analysis\r\n7. **Use GeoPackage** format for modern workflows (better than Shapefile)\r\n8. **Set max_distance** in sjoin_nearest for better performance",
    "user_template": ""
  },
  "variables": [],
  "install": {
    "steps": [
      {
        "title": "Download & unzip",
        "detail": "Download the .zip package from SkillVault and unzip it. The geopandas/ folder contains SKILL.md plus any companion scripts, references and assets."
      },
      {
        "title": "Copy into your agent skills directory",
        "detail": "Move the folder into your agent's skills directory — e.g. ~/.claude/skills/ (Claude Code), .codex/skills/, .cursor/skills/ or your project's .claude/skills/ folder — then restart or reload the session."
      },
      {
        "title": "Use it",
        "detail": "Describe the task in natural language; the agent loads the skill automatically when the request matches the skill description."
      }
    ]
  },
  "usage": {
    "steps": []
  },
  "metadata": {
    "author": "SkillVault",
    "source": "https://skillvault.top/skills/geopandas",
    "exported_at": "2026-11-03T07:44:36.062Z"
  }
}
geopandas.aiskill (YAML)
format: aiskill/v1
skill:
  name: geopandas
  slug: geopandas
  version: 1.0.0
  description: >-
    Python library for working with geospatial vector data including shapefiles, GeoJSON, and
    GeoPackage files. Use when working with geographic data for spatial analysis, geometric
    operations, coordinate transformations, spatial joins, overlay operations, choropleth mapping,
    or any task involving reading/writing/analyzing vector geographic data. Supports PostGIS
    databases, interactive maps, and integration with matplotlib/folium/cartopy. Use for tasks like
    buffer analysis, spatial joins between datasets, dissolving boundaries, clipping data,
    calculating areas/distances, reprojecting coordinate systems, creating maps, or converting
    between spatial file formats.
  category: Research
  tags:
    - research-science
    - sql
    - content
    - python
  platforms:
    - chatgpt
    - claude-code
    - cursor
  tested_environment: >-
    Agent Skills convention (SKILL.md) — works with Claude Code, Cursor, ChatGPT/Codex and
    compatible agents
  license: BSD-3-CLAUSE LICENSE
prompts:
  system: "# GeoPandas\r\n\r\nGeoPandas extends pandas to enable spatial operations on geometric types. It combines the capabilities of pandas and shapely for geospatial data analysis.\r\n\r\n## Installation\r\n\r\n```bash\r\nuv pip install geopandas\r\n```\r\n\r\n### Optional Dependencies\r\n\r\n```bash\r\n# For interactive maps\r\nuv pip install folium\r\n\r\n# For classification schemes in mapping\r\nuv pip install mapclassify\r\n\r\n# For faster I/O operations (2-4x speedup)\r\nuv pip install pyarrow\r\n\r\n# For PostGIS database support\r\nuv pip install psycopg2\r\nuv pip install geoalchemy2\r\n\r\n# For basemaps\r\nuv pip install contextily\r\n\r\n# For cartographic projections\r\nuv pip install cartopy\r\n```\r\n\r\n## Quick Start\r\n\r\n```python\r\nimport geopandas as gpd\r\n\r\n# Read spatial data\r\ngdf = gpd.read_file(\"data.geojson\")\r\n\r\n# Basic exploration\r\nprint(gdf.head())\r\nprint(gdf.crs)\r\nprint(gdf.geometry.geom_type)\r\n\r\n# Simple plot\r\ngdf.plot()\r\n\r\n# Reproject to different CRS\r\ngdf_projected = gdf.to_crs(\"EPSG:3857\")\r\n\r\n# Calculate area (use projected CRS for accuracy)\r\ngdf_projected['area'] = gdf_projected.geometry.area\r\n\r\n# Save to file\r\ngdf.to_file(\"output.gpkg\")\r\n```\r\n\r\n## Core Concepts\r\n\r\n### Data Structures\r\n\r\n- **GeoSeries**: Vector of geometries with spatial operations\r\n- **GeoDataFrame**: Tabular data structure with geometry column\r\n\r\nSee [data-structures.md](references/data-structures.md) for details.\r\n\r\n### Reading and Writing Data\r\n\r\nGeoPandas reads/writes multiple formats: Shapefile, GeoJSON, GeoPackage, PostGIS, Parquet.\r\n\r\n```python\r\n# Read with filtering\r\ngdf = gpd.read_file(\"data.gpkg\", bbox=(xmin, ymin, xmax, ymax))\r\n\r\n# Write with Arrow acceleration\r\ngdf.to_file(\"output.gpkg\", use_arrow=True)\r\n```\r\n\r\nSee [data-io.md](references/data-io.md) for comprehensive I/O operations.\r\n\r\n### Coordinate Reference Systems\r\n\r\nAlways check and manage CRS for accurate spatial operations:\r\n\r\n```python\r\n# Check CRS\r\nprint(gdf.crs)\r\n\r\n# Reproject (transforms coordinates)\r\ngdf_projected = gdf.to_crs(\"EPSG:3857\")\r\n\r\n# Set CRS (only when metadata missing)\r\ngdf = gdf.set_crs(\"EPSG:4326\")\r\n```\r\n\r\nSee [crs-management.md](references/crs-management.md) for CRS operations.\r\n\r\n## Common Operations\r\n\r\n### Geometric Operations\r\n\r\nBuffer, simplify, centroid, convex hull, affine transformations:\r\n\r\n```python\r\n# Buffer by 10 units\r\nbuffered = gdf.geometry.buffer(10)\r\n\r\n# Simplify with tolerance\r\nsimplified = gdf.geometry.simplify(tolerance=5, preserve_topology=True)\r\n\r\n# Get centroids\r\ncentroids = gdf.geometry.centroid\r\n```\r\n\r\nSee [geometric-operations.md](references/geometric-operations.md) for all operations.\r\n\r\n### Spatial Analysis\r\n\r\nSpatial joins, overlay operations, dissolve:\r\n\r\n```python\r\n# Spatial join (intersects)\r\njoined = gpd.sjoin(gdf1, gdf2, predicate='intersects')\r\n\r\n# Nearest neighbor join\r\nnearest = gpd.sjoin_nearest(gdf1, gdf2, max_distance=1000)\r\n\r\n# Overlay intersection\r\nintersection = gpd.overlay(gdf1, gdf2, how='intersection')\r\n\r\n# Dissolve by attribute\r\ndissolved = gdf.dissolve(by='region', aggfunc='sum')\r\n```\r\n\r\nSee [spatial-analysis.md](references/spatial-analysis.md) for analysis operations.\r\n\r\n### Visualization\r\n\r\nCreate static and interactive maps:\r\n\r\n```python\r\n# Choropleth map\r\ngdf.plot(column='population', cmap='YlOrRd', legend=True)\r\n\r\n# Interactive map\r\ngdf.explore(column='population', legend=True).save('map.html')\r\n\r\n# Multi-layer map\r\nimport matplotlib.pyplot as plt\r\nfig, ax = plt.subplots()\r\ngdf1.plot(ax=ax, color='blue')\r\ngdf2.plot(ax=ax, color='red')\r\n```\r\n\r\nSee [visualization.md](references/visualization.md) for mapping techniques.\r\n\r\n## Detailed Documentation\r\n\r\n- **[Data Structures](references/data-structures.md)** - GeoSeries and GeoDataFrame fundamentals\r\n- **[Data I/O](references/data-io.md)** - Reading/writing files, PostGIS, Parquet\r\n- **[Geometric Operations](references/geometric-operations.md)** - Buffer, simplify, affine transforms\r\n- **[Spatial Analysis](references/spatial-analysis.md)** - Joins, overlay, dissolve, clipping\r\n- **[Visualization](references/visualization.md)** - Plotting, choropleth maps, interactive maps\r\n- **[CRS Management](references/crs-management.md)** - Coordinate reference systems and projections\r\n\r\n## Common Workflows\r\n\r\n### Load, Transform, Analyze, Export\r\n\r\n```python\r\n# 1. Load data\r\ngdf = gpd.read_file(\"data.shp\")\r\n\r\n# 2. Check and transform CRS\r\nprint(gdf.crs)\r\ngdf = gdf.to_crs(\"EPSG:3857\")\r\n\r\n# 3. Perform analysis\r\ngdf['area'] = gdf.geometry.area\r\nbuffered = gdf.copy()\r\nbuffered['geometry'] = gdf.geometry.buffer(100)\r\n\r\n# 4. Export results\r\ngdf.to_file(\"results.gpkg\", layer='original')\r\nbuffered.to_file(\"results.gpkg\", layer='buffered')\r\n```\r\n\r\n### Spatial Join and Aggregate\r\n\r\n```python\r\n# Join points to polygons\r\npoints_in_polygons = gpd.sjoin(points_gdf, polygons_gdf, predicate='within')\r\n\r\n# Aggregate by polygon\r\naggregated = points_in_polygons.groupby('index_right').agg({\r\n    'value': 'sum',\r\n    'count': 'size'\r\n})\r\n\r\n# Merge back to polygons\r\nresult = polygons_gdf.merge(aggregated, left_index=True, right_index=True)\r\n```\r\n\r\n### Multi-Source Data Integration\r\n\r\n```python\r\n# Read from different sources\r\nroads = gpd.read_file(\"roads.shp\")\r\nbuildings = gpd.read_file(\"buildings.geojson\")\r\nparcels = gpd.read_postgis(\"SELECT * FROM parcels\", con=engine, geom_col='geom')\r\n\r\n# Ensure matching CRS\r\nbuildings = buildings.to_crs(roads.crs)\r\nparcels = parcels.to_crs(roads.crs)\r\n\r\n# Perform spatial operations\r\nbuildings_near_roads = buildings[buildings.geometry.distance(roads.union_all()) < 50]\r\n```\r\n\r\n## Performance Tips\r\n\r\n1. **Use spatial indexing**: GeoPandas creates spatial indexes automatically for most operations\r\n2. **Filter during read**: Use `bbox`, `mask`, or `where` parameters to load only needed data\r\n3. **Use Arrow for I/O**: Add `use_arrow=True` for 2-4x faster reading/writing\r\n4. **Simplify geometries**: Use `.simplify()` to reduce complexity when precision isn't critical\r\n5. **Batch operations**: Vectorized operations are much faster than iterating rows\r\n6. **Use appropriate CRS**: Projected CRS for area/distance, geographic for visualization\r\n\r\n## Best Practices\r\n\r\n1. **Always check CRS** before spatial operations\r\n2. **Use projected CRS** for area and distance calculations\r\n3. **Match CRS** before spatial joins or overlays\r\n4. **Validate geometries** with `.is_valid` before operations\r\n5. **Use `.copy()`** when modifying geometry columns to avoid side effects\r\n6. **Preserve topology** when simplifying for analysis\r\n7. **Use GeoPackage** format for modern workflows (better than Shapefile)\r\n8. **Set max_distance** in sjoin_nearest for better performance"
  user_template: ""
variables: []
install:
  steps:
    - title: Download & unzip
      detail: >-
        Download the .zip package from SkillVault and unzip it. The geopandas/ folder contains
        SKILL.md plus any companion scripts, references and assets.
    - title: Copy into your agent skills directory
      detail: >-
        Move the folder into your agent's skills directory — e.g. ~/.claude/skills/ (Claude Code),
        .codex/skills/, .cursor/skills/ or your project's .claude/skills/ folder — then restart or
        reload the session.
    - title: Use it
      detail: >-
        Describe the task in natural language; the agent loads the skill automatically when the
        request matches the skill description.
usage:
  steps: []
metadata:
  author: SkillVault
  source: https://skillvault.top/skills/geopandas
  exported_at: "2026-11-03T07:44:36.062Z"

安装指南

  1. 1

    Download & unzip

    Download the .zip package from SkillVault and unzip it. The geopandas/ folder contains SKILL.md plus any companion scripts, references and assets.

  2. 2

    Copy into your agent skills directory

    Move the folder into your agent's skills directory — e.g. ~/.claude/skills/ (Claude Code), .codex/skills/, .cursor/skills/ or your project's .claude/skills/ folder — then restart or reload the session.

  3. 3

    Use it

    Describe the task in natural language; the agent loads the skill automatically when the request matches the skill description.

使用方法

平台兼容性

ChatGPT GPTs

OpenAI

将系统提示词粘贴到 GPT 的「Instructions」字段,并把用户模板作为起始消息使用。

官方文档

Claude Code

Anthropic

将导出的 .aiskill JSON 保存为项目中的技能文件,或将系统提示词粘贴进 CLAUDE.md / 斜杠命令 Markdown 文件。

官方文档

Cursor

Anysphere

将系统提示词复制到 .cursor/rules/*.mdc(或设置中的 Project Rules),并在智能体提示词中引用用户模板。

官方文档

相关技能

matlab AI agent skill cover
免费
ChatGPT GPTs Claude Code Cursor

matlab

MATLAB and GNU Octave numerical computing for matrix operations, data analysis, visualization, and scientific computing. Use when writing MATLAB/Octave scripts for linear algebra, signal processing, image processing, differential equations, optimization, statistics, or creating scientific visualizations. Also use when the user needs help with MATLAB syntax, functions, or wants to convert between MATLAB and Python code. Scripts can be executed with MATLAB or the open-source GNU Octave interpreter.

#research-science#data-viz#content
0 0 v1.0.0
astropy AI agent skill cover
免费
ChatGPT GPTs Claude Code Cursor

astropy

Comprehensive Python library for astronomy and astrophysics. This skill should be used when working with astronomical data including celestial coordinates, physical units, FITS files, cosmological calculations, time systems, tables, world coordinate systems (WCS), and astronomical data analysis. Use when tasks involve coordinate transformations, unit conversions, FITS file manipulation, cosmological distance calculations, time scale conversions, or astronomical data processing.

#research-science#python
0 0 v1.0.0
citation-management AI agent skill cover
免费
ChatGPT GPTs Claude Code Cursor

citation-management

Comprehensive citation management for academic research. Search Google Scholar and PubMed for papers, extract accurate metadata, validate citations, and generate properly formatted BibTeX entries. This skill should be used when you need to find papers, verify citation information, convert DOIs to BibTeX, or ensure reference accuracy in scientific writing.

#research-science#research#content
0 0 v1.0.0