Content
# Tool List
Through Claude Code, operate ArcGIS 10.2 with natural language, covering daily GIS operations in land resource management.
## Prerequisites
| Software | Requirements |
| ------------- | -------------------------- |
| ArcGIS 10.2 | Installed, ArcPy available |
| Python 3.10+ | For running MCP Server |
| Claude Code | Installed and logged in |
## Installation
### Step 1: Clone the Repository
```bash
git clone https://github.com/ffff231231/ArcGIS10.2-MCP-Server.git
cd ArcGIS10.2-MCP-Server
```
### Step 2: Run the Installation Script
Open a terminal in the project directory and run:
```bash
python scripts/setup.py
```
The script will automatically:
- Detect Python 3 and ArcGIS Python 2.7 paths on your computer (through registry and common paths)
- Install the MCP SDK (using Tsinghua mirror source, no need to bypass the firewall in China)
- Generate `config.py` (ArcGIS Python path) and `.mcp.json` (MCP Server configuration)
- Verify if all components are working properly
If automatic detection fails, it will prompt you to manually input the paths.
### Step 3: Start Claude Code
Open Claude Code in the project directory, and the MCP Server will load automatically.
> If you want to confirm if the environment is ready, you can run `python scripts/check_setup.py`
## Usage
### Start
1. Open Claude Code in the project directory
2. Input `/arcgis` to load land resource management domain knowledge
3. Describe the operation you want to perform in natural language
### Example Conversation
```
You: Help me check the coordinate system and field information of D:\data\land_use.shp
Claude: (Automatically call describe_feature_class tool)
You: Select all dry land from this shp and save it to D:\output\handi.shp
Claude: (Automatically call select_features tool, where_clause = "DLMC = '旱地'")
You: Calculate the area of each land type in mu
Claude: (Automatically call land_area_statistics tool)
You: Help me project all shp files under D:\data\ to WGS84 and output to D:\data_wgs84\
Claude: (Automatically call batch_project tool)
```
## 32 Tool List
### Information Query (4)
| Tool | Function | Key Parameters |
| ------------------------ | ------------------------------------------ | ---------------------------------------- |
| `get_arcgis_environment` | Check ArcGIS license and environment info | None |
| `list_feature_classes` | List feature classes in workspace | workspace, wildcard |
| `describe_feature_class` | Check feature class metadata (coordinate system, fields, extent) | input_path |
| `get_projection_info` | Query coordinate system info | WKID number / .prj path / feature class path |
### Overlay Analysis (5)
| Tool | Function | Key Parameters |
| ------------------- | ---------------------------- | ---------------------------------------- |
| `clip_features` | Clip (cut with polygon layer) | input_features, clip_features |
| `intersect_layers` | Intersect (multi-layer intersection) | input_features (list) |
| `union_layers` | Union (multi-layer union) | input_features (list) |
| `identity_analysis` | Identify (overlay and pass attributes) | input_features, identity_features |
| `erase_features` | Erase (remove overlapping area) | input_features, erase_features |
### Proximity Analysis (2)
| Tool | Function | Key Parameters |
| ----------------- | ---------------------------------- | ---------------------------------------- |
| `buffer_analysis` | Buffer analysis | buffer_distance (e.g., "100 meters") |
| `spatial_join` | Spatial join (pass attributes by spatial relationship) | match_option, search_radius |
### Data Management (8)
| Tool | Function | Key Parameters |
| ------------------------- | ---------------------------- | ---------------------------------- |
| `merge_datasets` | Merge multiple feature classes | input_datasets (list) |
| `append_features` | Append to existing feature class | target_dataset, schema_type |
| `dissolve_features` | Dissolve adjacent features by field | dissolve_field |
| `select_features` | Select features by attribute condition | where_clause (SQL expression) |
| `split_features` | Split features by another layer | split_features, split_field |
| `multipart_to_singlepart` | Split multi-part features into single parts | input_features |
| `copy_or_delete` | Copy or delete feature classes | action: "copy" / "delete" |
| `convert_feature_class` | Convert feature class format (shp/gdb interchange) | output path determines format |
### Projection Conversion (2)
| Tool | Function | Key Parameters |
| ----------------------- | -------------------------------- | -------------------------------------------- |
| `batch_project` | Batch project feature classes in workspace | input_workspace, out_coordinate_system |
| `project_feature_class` | Project a single feature class | out_coordinate_system (WKID e.g., "4326") |
### Field Operation (4)
| Tool | Function | Key Parameters |
| -------------------- | --------------------------------- | -------------------------------------------- |
| `field_processing` | Add/calculate/delete fields | action: "add" / "calculate" / "delete" |
| `calculate_geometry` | Calculate area/perimeter/coordinates into fields | property_type, area_unit |
| `add_xy_coordinates` | Add coordinates fields to point features | x_field, y_field |
| `table_join` | Join external table (CSV/DBF) to feature class | input_field, join_field |
### Statistics Report (4)
| Tool | Function | Key Parameters |
| ---------------------- | ---------------------- | ------------------------------------ |
| `land_area_statistics` | Calculate area by land type | land_use_field, area_unit |
| `frequency_statistics` | Calculate frequency by field combination | frequency_fields |
| `summary_statistics` | Calculate summary statistics for numerical fields | statistics_fields, case_field |
| `table_to_csv` | Export attribute table to CSV | output_path |
### Mapping (1)
| Tool | Function | Key Parameters |
| --------------- | -------------------------------- | ----------------------------- |
| `batch_mapping` | Export PNG/PDF/JPEG from MXD | mxd_path, output_format |
### Repair (1)
| Tool | Function | Key Parameters |
| ----------------- | --------------------- | --------------------------------- |
| `repair_geometry` | Detect/repair geometric errors | validate_only: true only detect |
### Conversion (1)
| Tool | Function | Key Parameters |
| ------------------ | ------------------- | -------------------------------------------- |
| `feature_to_point` | Extract centroid/inner point | point_location: "CENTROID" / "INSIDE" |
## Common Coordinate Systems
| Name | WKID | Description |
| ------------------- | ---- | ------------------------- |
| CGCS2000 Geographic Coordinate System | 4490 | China Geodetic Coordinate System 2000 |
| CGCS2000 3-degree Zone 39 | 4527 | Central Meridian 117E |
| CGCS2000 3-degree Zone 40 | 4528 | Central Meridian 120E |
| WGS 84 | 4326 | GPS Universal Coordinate System |
More coordinate systems can be queried through the `get_projection_info` tool by inputting the WKID number.
## Area Units
Used in `land_area_statistics` and `calculate_geometry`:
| Parameter Value | Unit | Conversion |
| ------------------- | -------- | --------------------------- |
| `SQUARE_METERS` | Square Meters | Base unit |
| `HECTARES` | Hectares | 1 hectare = 10000 square meters |
| `SQUARE_KILOMETERS` | Square Kilometers | 1 square kilometer = 100 hectares |
| `MU` | Mu | 1 hectare = 15 mu |
## Common Workflows
### Land Type Area Statistics Report
```
You: Help me calculate the area of each land type in D:\data\xian_dltb.shp by DLMC field in mu and export to CSV
```
Claude will call: describe_feature_class -> land_area_statistics -> table_to_csv
### Two-Period Land Use Change Analysis
```
You: D:\data\2020_dltb.shp and D:\data\2025_dltb.shp are two-period land type maps,
help me analyze the changes and find the features with changed land types
```
### Batch Projection
```
You: Project all shp files under D:\data\cgcs2000\ to WGS84 and output to D:\data\wgs84\
```
### Construction Land Examination
```
You: Select construction land (DLBM starts with 05, 06, 07) from D:\data\dltb.shp,
clip to D:\data\guihua.shp extent, and calculate the area
```
## Architecture
```
Claude Code <--stdio/MCP--> Python 3 MCP Server <--subprocess/JSON--> Python 2.7 ArcPy
```
- MCP Server runs on Python 3 (using mcp SDK)
- ArcPy scripts execute on Python 2.7 through subprocess
- Parameters are passed through stdin in JSON, and results are returned through stdout in JSON
- Scripts are delivered as temporary .py files, supporting Chinese paths
## Project Structure
```
Local ArcGIS Automation Tool/
.mcp.json # Claude Code MCP Server configuration
.claude/commands/arcgis.md # Land resource management domain knowledge Skill
src/arcgis_mcp/
server.py # MCP Server (32 tool definitions)
bridge.py # Python 3 <-> Python 2.7 bridge
config.py # Path configuration (automatically generated by setup.py)
validators.py # Parameter validation
templates/ # 32 ArcPy script templates
scripts/
setup.py # One-click installation and configuration script
check_setup.py # Environment diagnosis script
```
## Troubleshooting
| Issue | Solution |
| ---------------- | --------------------------------------------------------- |
| MCP Server not loaded | Confirm starting Claude Code in the project directory, check if .mcp.json exists |
| ArcPy execution failed | Run `python scripts/check_setup.py` to check the environment |
| Chinese path error | Confirm the path has no special characters, use the full absolute path |
| Projection conversion failed | May need to specify the transform_method parameter |
| Field not found | Use `describe_feature_class` to check the actual field name |
| Slow pip installation | The script has configured the Tsinghua mirror source, no manual processing needed |
Connection Info
You Might Also Like
No recommendations available