GEO-MCP服务器
挪威地理信息和测量工作流的模型上下文协议(MCP)服务器
  
GEO-MCP服务器为AI助手(Claude、Cursor等)提供以下专业功能:
- 点云处理 (LAS/LAZ文件)
- FKB指南 (挪威制图标准)
- SOSI文件生成 (挪威GIS格式)
- 测量计算 (调整、拓扑、精度)
- 格式转换 (SOSIS)↔ GeoJSON、LAS→SOSI)
- GPU加速
______________________________________________________________________
快速开始
安装
- 克隆存储库:
git clone https://github.com/yourusername/GEO-MCP.git
cd GEO-MCP- 创建conda环境:
conda env create -f environment.yml
conda activate geo-mcp-env- 测试服务器:
python app.py
# Should start without errors使用Claude代码
- 配置MCP服务器 在您的克劳德代码设置中:
{
"mcpServers": {
"geo-mcp": {
"command": "conda",
"args": [
"run",
"-n",
"geo-mcp-env",
"python",
"/absolute/path/to/GEO_MCP/app.py"
]
}
}
}- 重新启动Claude代码 加载服务器
- 在对话中使用MCP工具:
- “根据FKB-B标准验证此SOSI文件” - “从该LAS文件中提取建筑物并生成SOSI输出” - “将此SOSI文件转换为GeoJSON” - “分析点云,告诉我建筑密度”
______________________________________________________________________
特性
点云处理
从LAS/LAZ文件中提取特征:
- 按分类代码加载和过滤
- HDBSCAN/DBSCAN集群
- RANSAC平面配件
- 建筑足迹提取
- 阿尔法形状和边界
- B样条曲线拟合
- GPU加速(可选)
可用工具:
load_and_filter_pointcloud-使用分类过滤加载LAS/LAZcluster_pointcloud_advanced-高级HDBSCAN/DBSCAN集群fit_plane_ransac_advanced-RANSAC平面配件extract_building_footprint_advanced-阿尔法形状足迹提取analyze_point_cloud_file-获取点云统计数据
FKB验证
根据挪威FKB 5.1标准进行验证:
- 已实施400+验证规则
- 属性验证(强制/可选)
- 几何验证(有效性、拓扑)
- 精度验证(FKB-A/B/C/D标准)
- 元数据验证(KVALITET块)
- SOSI格式验证
- 拓扑验证(2型扁平化器,网络)
可用工具:
validate_fkb_sosi_file-使用HTML报告完成FKB验证validate_fkb_object-验证单个功能get_fkb_accuracy_recommendations-获取FKB标准的加工参数
SOSI生成
生成符合FKB标准的SOSI文件:
- 自动。HODE截面生成
- 整数坐标编码
- KVALITET块生成
- 导出前的功能验证
- 双输出(SOSI+GeoJSON)
可用工具:
extract_buildings_to_sosi-拉斯→ 建筑物→ SOSI管道export_to_sosi-将特征导出为SOSI格式convert_sosi_to_geojson-将SOSI转换为GeoJSON
测量工具
专业测量计算:
- 最小二乘平差
- 网络分析
- 坐标变换
- 准确性指标
- 统计测试
______________________________________________________________________
可用工具
总计:39个MCP工具,15个资源
核心点云工具(10)
| 工具 | 说明 |
|---|---|
load_and_filter_pointcloud | 使用分类过滤加载LAS/LAZ |
cluster_pointcloud_advanced | 带有统计数据的HDBSCAN/DBSCAN聚类 |
fit_plane_ransac_advanced | 精细的RANSAC平面拟合 |
detect_multiple_planes | 顺序多平面检测 |
extract_building_footprint_advanced | 阿尔法形状足迹提取 |
compute_alpha_shape | 凹壳计算 |
fit_spline_to_points | B样条曲线拟合 |
segment_buildings_from_ground_advanced | 建筑细分 |
estimate_point_cloud_spacing | 点间距分析 |
check_gpu_availability | GPU性能检测 |
FKB工具(8)
| 工具 | 说明 |
|---|---|
validate_fkb_sosi_file | ⭐ 使用HTML报告验证SOSI文件 |
convert_sosi_to_geojson | 将SOSI转换为GeoJSON |
analyze_point_cloud_file | 点云统计 |
extract_buildings_to_sosi | ⭐ 完成LAS→ SOSI管道 |
get_fkb_accuracy_recommendations | FKB加工参数 |
validate_fkb_object | 验证单个功能 |
lookup_fkb_code | FKB代码查找 |
export_to_sosi | 导出为SOSI格式 |
测量工具(12)
- 网平差
- 坐标变换
- 拓扑分析
- 验证检查
- 还有更多。..
几何工具(9)
- 点聚类
- 几何基元
- 距离计算
- 拓扑操作
- 还有更多。..
______________________________________________________________________
📚 文档
综合指南
点云处理:
FKB标准:
验证:
提取管道:
- FKB提取管道 -拉斯→ SOSI工作流程
集成:
- 集成摘要 -点云模块概述
MCP资源
所有文档均可作为MCP资源访问:
file://fkb_rules_consolidated - Master FKB rules (33KB)
file://fkb_validation_checklist - Validation workflow (32KB)
file://ransac_guide - RANSAC tutorial (10KB)
file://clustering_guide - Clustering guide (12KB)
file://geometric_extraction_guide - Extraction guide (15KB)
... and 10 more______________________________________________________________________
🎯 用例
1.验证现有FKB数据
User: "Validate buildings.sos against FKB-B standards and show me the report"
Claude uses:
validate_fkb_sosi_file('buildings.sos', 'B', generate_html_report=True)
Result:
- Validation report with error details
- HTML report for visual inspection
- Pass/fail status with error counts2.从点云中提取建筑物
User: "Extract all buildings from scan.las and generate FKB-compliant SOSI output"
Claude uses:
extract_buildings_to_sosi(
'scan.las',
'buildings.sos',
fkb_standard='B',
coordinate_system=25,
origo_ne=[6500000, 100000]
)
Result:
- SOSI file with building footprints
- GeoJSON for visualization
- Validation report
- Statistics (building count, areas, etc.)3.格式转换
User: "Convert this SOSI file to GeoJSON for use in QGIS"
Claude uses:
convert_sosi_to_geojson('data.sos', 'data.geojson')
Result:
- GeoJSON file ready for QGIS/web maps
- Feature count and CRS info4.分析点云质量
User: "Analyze this LAS file and tell me about the building points"
Claude uses:
analyze_point_cloud_file('scan.las', classification_codes=[6])
Result:
- Total points and building points
- Spatial extent (bounds)
- Point density
- Height statistics______________________________________________________________________
🏗️ 建筑
GEO-MCP Server
├── MCP Interface (FastMCP)
│ ├── 39 Tools (exposed to AI assistants)
│ └── 15 Resources (documentation)
│
├── Point Cloud Processing
│ ├── pointcloud_core.py (FKB-aware processing)
│ ├── clustering.py (HDBSCAN/DBSCAN)
│ ├── ransac_fitting.py (geometric fitting)
│ ├── geometric_extraction.py (footprints, boundaries)
│ └── gpu_utils.py (GPU acceleration)
│
├── FKB Validation
│ ├── FKB/validation/
│ │ ├── fkb_validators.py (20 validators)
│ │ ├── validation_report.py (HTML reports)
│ │ └── test_validators.py (30+ tests)
│ └── FKB/extracted/ (400+ rules from specs)
│
├── SOSI Processing
│ ├── FKB/sosi_parser.py (parse SOSI files)
│ ├── sosi_generator.py (generate SOSI files)
│ └── geometric_extraction.py (SOSI output)
│
└── Surveying Tools
├── adjustment_tools.py
├── surveying_tools.py
├── topology_tools.py
└── validation_tools.py______________________________________________________________________
📊 统计
- 代码行: 10000+(Python)
- 文档: 2000+行(Markdown、YAML)
- FKB规则: 已实施400+验证规则
- 对象类型: 支持164种FKB对象类型
- 测试覆盖范围: 30+单元测试
- MCP工具: 39
- MCP资源: 15
______________________________________________________________________
🔧 需求
Python依赖关系
python >= 3.10
fastmcp
numpy
scipy
shapely
laspy
open3d
hdbscan
scikit-learn
pyyaml
alphashape可选依赖
cupy # GPU acceleration
cuml # GPU clustering
pytest # Running tests
pytest-cov # Test coverage______________________________________________________________________
📖 FKB标准
GEO-MCP服务器支持所有四种FKB精度标准:
| 标准 | 水平精度 | 垂直精度 | 用例 |
|---|---|---|---|
| FKB-A | 3-30cm | 3-30cm | 高精度工程,地籍 |
| FKB-B | 6-60cm | 6-60cm | 标准市政测绘 |
| FKB-C | 15-150厘米 | 15-150厘米 | 测绘、规划概述 |
| FKB-D | 30-300cm | 30-300cm | 背景数据,大比例尺 |
每个标准都有4个精度等级,用于细粒度控制。
______________________________________________________________________
🧪 测试
运行单元测试
# All tests
pytest
# Specific module
pytest FKB/validation/test_validators.py -v
# With coverage
pytest --cov=FKB.validation --cov-report=html测试服务器
# Start server (stdio transport)
python app.py
# In another terminal, test with MCP client
python test_server.py测试示例工作流
# Generate test SOSI file
python sosi_generator.py
# Parse it back
python FKB/sosi_parser.py output/bygninger.sos
# Validate it
python -c "
from FKB.sosi_parser import parse_sosi_file
from FKB.validation import validate_dataset
features, header = parse_sosi_file('output/bygninger.sos')
report = validate_dataset(features, header, 'B')
print(f'Errors: {report[\"summary\"][\"total_errors\"]}')
"______________________________________________________________________
🤝 贡献
这目前是一个个人项目,但欢迎投稿!
开发环境设置
- 分叉存储库
- 创建要素分支
- 进行更改
- 如果适用,添加测试
- 更新文档
- 提交拉取请求
代码的风格
- 关注PEP 8
- 使用类型提示
- 将文档字符串添加到所有公共函数中
- 在文档字符串中包含示例
______________________________________________________________________
📜 许可证
MIT许可证-请参阅 许可证 详细信息文件
______________________________________________________________________
🙏 致谢
- 地图 -挪威测绘局(FKB规范)
- FastMCP -MCP服务器框架
- Open3D -点云处理
- 形状 -几何运算
______________________________________________________________________
📞 支持
文档
问题
- 报告GitHub问题上的错误
- 欢迎功能请求
- 问题?展开讨论
______________________________________________________________________
🗺️ 路线图
完成✅
- ✅ 点云处理流水线
- ✅ FKB验证(400+条规则)
- ✅ SOSI解析器和生成器
- ✅ 配备39个工具的MCP服务器
- ✅ 全面的文件
未来的增强功能
- \[\]2型平地机(单独的边界特征)
- \[\]多数据集SOSI支持
- \[\]验证报告的Web UI
- \[\]批处理CLI
- \[\]后GIS集成
- \[\]QGIS插件中的实时验证
- \[\]更多对象类型(道路、水、植被)
- \[\]激发合规性检查
______________________________________________________________________
📊 项目状态
版本: 0.1.0 状态: ✅ 生产就绪 最后更新时间: 2025-11-05 python 3.10+ 许可证: 麻省理工学院
______________________________________________________________________
由以下材料制成❤️ 挪威地理信息工作流程
*GEO-MCP服务器-为专业测绘提供人工智能辅助*
