人工智能(AI)在测绘中的应用已从辅助工具演变为驱动行业变革的核心力量,尤其在数据采集、处理、分析与服务全链条中展现出显著优势。
核心应用场景
自动化图像识别与地物提取
AI通过深度学习模型,可自动识别遥感影像、无人机航拍图、激光点云中的道路、建筑物、水体、植被等地物,分类准确率超90%,大幅替代人工解译。高精度地形测量与三维建模
融合LiDAR点云与AI技术,实现自动精细分类(如区分车辆、植被、管线等),提升数字表面模型(DSM)和数字高程模型(DEM)生成效率,人工编辑工作量显著降低。智能地理信息系统(GIS)
AI赋能GIS实现空间数据趋势预测、决策支持与智能分析,例如自动识别耕地“非农化”“非粮化”、违法建设、河湖四乱等问题。实景三维建设
AI驱动“空天地”一体化感知,支持城市级、部件级实景三维模型快速构建,为数字孪生城市提供统一时空基底。农业与自然资源普查
在第四次全国农业普查中,采用“卫星看、AI算、人工核”模式,自动勾勒田块边界、识别作物类型,效率与精度大幅提升。灾害监测与预警
AI结合遥感与铁塔视频,实现滑坡、地面沉降、森林火情、防溺水等风险的主动识别与预警,推动治理从“被动应对”转向“主动防控”。大模型与知识服务
自然资源部门部署国产大模型(如DeepSeek),构建智能问答、政策预审、时空知识图谱等能力,支撑自然资源治理“智能中枢”。
典型实践案例
写cad插件
在ai对话框写:帮我写一个cad自动标注autolisp插件代码,同时自动标注直线,圆弧, 圆形,正方形,等几何图形多线段的插件,以及使用步骤,标注样式随线段长度而变化,尺寸标注尽量在图形外围
自动生成插件并附注说明书如下
(defun c:AutoDim (/ ss i ent type pt1 pt2 cen rad len ang dist offset dimstyle dimpos)
(vl-load-com)
(setq ss (ssget '((0 . "LINE,ARC,CIRCLE,POLYLINE,LWPOLYLINE,RECTANGLE"))))
(if ss
(progn
(setq i 0)
(repeat (sslength ss)
(setq ent (ssname ss i))
(setq type (cdr (assoc 0 (entget ent))))
(cond
;; 直线
((equal type "LINE")
(setq pt1 (cdr (assoc 10 (entget ent)))
pt2 (cdr (assoc 11 (entget ent)))
len (distance pt1 pt2))
(setq dimpos (get_exterior_dim_position pt1 pt2 len))
(command "_dimlinear" pt1 pt2 dimpos "")
)
;; 圆弧
((equal type "ARC")
(setq cen (cdr (assoc 10 (entget ent)))
rad (cdr (assoc 40 (entget ent)))
ang1 (cdr (assoc 50 (entget ent)))
ang2 (cdr (assoc 51 (entget ent)))
len (* rad (- ang2 ang1)))
(setq dimpos (get_exterior_dim_position_arc cen rad ang1 ang2))
(command "_dimarc" ent dimpos "")
)
;; 圆形
((equal type "CIRCLE")
(setq cen (cdr (assoc 10 (entget ent)))
rad (cdr (assoc 40 (entget ent)))
len (* 2 rad))
(setq dimpos (polar cen (+ (angle cen (polar cen 0 1)) (/ pi 2)) (+ rad 10)))
(command "_dimdiameter" ent dimpos "")
)
;; 多段线/正方形(闭合多段线)
((or (equal type "LWPOLYLINE") (equal type "POLYLINE"))
(if (vlax-curve-isClosed ent)
(progn
(setq pts (vlax-safearray->list (vlax-variant-value (vlax-get-property (vlax-ename->vla-object ent) 'Coordinates))))
(if (= (length pts) 8) ; 四个点,可能是矩形
(progn
(setq pt1 (list (nth 0 pts) (nth 1 pts))
pt2 (list (nth 2 pts) (nth 3 pts))
pt3 (list (nth 4 pts) (nth 5 pts))
pt4 (list (nth 6 pts) (nth 7 pts))
len1 (distance pt1 pt2)
len2 (distance pt2 pt3))
(if (> len1 len2)
(setq dimpos (get_exterior_dim_position pt1 pt2 len1))
(setq dimpos (get_exterior_dim_position pt2 pt3 len2))
)
(command "_dimlinear" pt1 pt2 dimpos "")
)
)
)
)
)
)
(setq i (1+ i))
)
(princ "\n✓ 自动标注完成!")
)
(princ "\n× 未选择任何有效图形。")
)
(princ)
)
;; 获取直线的外部标注位置(避开图形)
(defun get_exterior_dim_position (pt1 pt2 len / mid ang perp dist offset)
(setq mid (mapcar '(lambda (a b) (/ (+ a b) 2)) pt1 pt2))
(setq ang (angle pt1 pt2))
(setq perp (+ ang (/ pi 2)))
(setq dist (if (< len 50) 15 (if (< len 200) 25 40))) ; 标注偏移随长度变化
(setq offset (polar mid perp dist))
offset
)
;; 获取圆弧的外部标注位置
(defun get_exterior_dim_position_arc (cen rad ang1 ang2 / midang dist offset)
(setq midang (/ (+ ang1 ang2) 2))
(setq dist (if (< rad 20) 12 (if (< rad 100) 20 35))) ; 标注偏移随半径变化
(setq offset (polar cen midang (+ rad dist)))
offset
)
;; 可选:设置标注样式(根据长度动态切换)
(defun c:SetDimStyle (/ len style)
(setq len (getreal "\n请输入参考长度(单位:mm): "))
(cond
((< len 30) (command "_dimstyle" "_set" "Small"))
((< len 100) (command "_dimstyle" "_set" "Medium"))
(t (command "_dimstyle" "_set" "Large"))
)
(princ "\n✓ 标注样式已根据长度设置。")
(princ)
)
;; 初始化标注样式(首次运行时调用)
(defun init_dim_styles (/)
(if (not (tblsearch "dimstyle" "Small"))
(progn
(command "_dimstyle" "_new" "Small" "_save")
(command "_dimstyle" "_set" "Small")
(command "_dimasz" 1.5)
(command "_dimtxt" 2.5)
(command "_dimdle" 1.0)
)
)
(if (not (tblsearch "dimstyle" "Medium"))
(progn
(command "_dimstyle" "_new" "Medium" "_save")
(command "_dimstyle" "_set" "Medium")
(command "_dimasz" 2.0)
(command "_dimtxt" 3.5)
(command "_dimdle" 1.5)
)
)
(if (not (tblsearch "dimstyle" "Large"))
(progn
(command "_dimstyle" "_new" "Large" "_save")
(command "_dimstyle" "_set" "Large")
(command "_dimasz" 2.5)
(command "_dimtxt" 5.0)
(command "_dimdle" 2.0)
)
)
(princ "\n✓ 标注样式库已初始化(Small/Medium/Large)")
(princ)
)
;; 启动时自动初始化样式
(init_dim_styles)
(princ "\n加载完成:输入 AutoDim 开始自动标注,输入 SetDimStyle 手动设置样式。")
(princ)
; 本插件为AutoLISP脚本,适用于AutoCAD 2010及以上版本
; 无需外部依赖包,仅需标准AutoCAD环境
; 建议配合使用:ISO-25 或 ANSI 标注标准
; 使用前请确保:
; 1. 已启用AutoLISP加载(APPLOAD命令)
; 2. 图形中对象为标准几何实体(非块、非参照)
; 3. 当前UCS为世界坐标系(WCS)以确保定位准确
写arcgis python插件
在ai对话框写:帮我写一个批量裁切gdb库体python插件
import arcpy
import os
from pathlib import Path
def batch_clip_geodatabase(input_gdb, clip_feature, output_gdb, output_format="GDB", overwrite=True):
"""
批量裁切地理数据库中的所有要素类(Feature Class)
参数:
input_gdb: 输入File Geodatabase路径
clip_feature: 裁切范围要素(如杭州行政区划边界图层)
output_gdb: 输出GDB路径(若为Shapefile则为输出文件夹)
output_format: 输出格式,"GDB" 或 "SHAPEFILE"
overwrite: 是否覆盖已有输出
"""
# 设置环境
arcpy.env.overwriteOutput = overwrite
arcpy.env.workspace = input_gdb
# 获取所有要素类
feature_classes = arcpy.ListFeatureClasses()
if not feature_classes:
print("⚠️ 输入GDB中未找到任何要素类。")
return
# 创建输出路径
if output_format == "GDB":
if not arcpy.Exists(output_gdb):
arcpy.CreateFileGDB_management(os.path.dirname(output_gdb), os.path.basename(output_gdb))
output_path = output_gdb
else: # SHAPEFILE
Path(output_gdb).mkdir(parents=True, exist_ok=True)
output_path = output_gdb
print(f"✅ 开始裁切 {len(feature_classes)} 个要素类...")
for fc in feature_classes:
try:
output_fc = os.path.join(output_path, fc)
if output_format == "SHAPEFILE":
output_fc = output_fc.replace(".shp", "") + ".shp" # 确保后缀正确
arcpy.Clip_analysis(fc, clip_feature, output_fc)
print(f" ✔️ 已裁切: {fc} → {os.path.basename(output_fc)}")
except Exception as e:
print(f" ❌ 裁切失败 {fc}: {str(e)}")
print(f"🎉 批量裁切完成!输出路径: {output_path}")
if __name__ == "__main__":
# ========== 用户配置区 ==========
INPUT_GDB = r"C:\Data\Hangzhou_Original.gdb" # 原始GDB路径(如从天地图或测绘局获取)
CLIP_FEATURE = r"C:\Data\Hangzhou_Boundary.shp" # 杭州市行政区划边界(必须为面要素)
OUTPUT_GDB = r"C:\Data\Hangzhou_Clip.gdb" # 输出GDB路径
OUTPUT_FORMAT = "GDB" # "GDB" 或 "SHAPEFILE"
OVERWRITE = True # 是否覆盖已有文件
# ========== 配置结束 ==========
batch_clip_geodatabase(INPUT_GDB, CLIP_FEATURE, OUTPUT_GDB, OUTPUT_FORMAT, OVERWRITE)