ArcGIS Python开发.pdf
文本预览下载声明
ArcGIS Python 开发
Esri中国(北京)有限公司 黄炎
内容摘要
• ArcGIS Python开发概述
• Python脚本语言快速入门
• ArcPy——ArcGIS Python API
• ArcGIS Python开发和使用
- GP工具的批处理脚本
- 新建ArcGIS脚本工具
- 通过GP服务在线调用
• 总结与展望
ArcGIS Python 开发概述
Python是什么?
• “Python is an easy to learn, powerful
language… (with) high-level data structures
and a simple but effective approach to object-
oriented programming. Python’s elegant
syntax and dynamic typing…make it an ideal
language for scripting…in many areas and on
most platforms.” –
• ArcGIS 的脚本语言
• 免费、跨平台、简单易用、使用广泛、社区火
热
为什么使用Python脚本?
• Python是一种高效率的语言
• 显著减少花费在项目上的时间
- 快速执行工具和函数
- 自动化执行常用任务
• 代码易于阅读和维护
- 这是Python设计的初衷
- 易于修改和不断更新
Python可以帮助完成那些工作?
影像处理
制图自动化 网络分析
批处理脚本 空间分析
构建GP工具 空间统计
在线分析 空间数据库
GP服务 管理和维护
等等…
在ArcGIS 中使用Python的几种方式
Desktop Server
Script Tool
Python Window
Geoprocessing Service
Standalone Script: IDE, Command
Line, Scheduled Task
Python脚本语言快速入门
Python 101
• 在哪写Python代码?
- IDE,例如:IDLE、PythonWin、PyScripter
- Python window in ArcGIS
• 怎样运行一段Python脚本?
- 双击脚本或者通过命令行
• 哪些是Python中的变量?
- A name that stores a value; assigned using =
input = C:/Data/Roads.shp
distance = 50
both = [input, distance]
# Variables act as substitutes for raw values
arcpy.Buffer_analysis(input, Roads_buffer.shp, distance)
Python 101
• 充分利用Python核心数据结构的优势
Type Explanation Example
显示全部