推荐星级:
  • 1
  • 2
  • 3
  • 4
  • 5

Python ArcPy在地质信息处理中的基本应用

更新时间:2019-12-26 10:48:50 大小:1M 上传用户:songhuahua查看TA发布的资源 标签:python地质信息处理 下载积分:1分 评价赚积分 (如何评价?) 收藏 评论(0) 举报

资料介绍

Python语言作为一种开源语言,在GIS软件中,常作为辅助工具使用,其为Arc GIS提供了大量的处理模块,能更高效地完成地质信息处理工作。利用Python语言,调用集成Arc GIS中Arc Py软件包,能实现地质数据的输入、投影变换以及标准图幅查询等功能,同时其代码简单易读,便于使用,可为地质数据处理人员提供更方便的工具。


部分文件列表

文件名 大小
Python_ArcPy在地质信息处理中的基本应用.pdf 1M

部分页面预览

(完整内容请下载后查看)
·15·  
201733( 1) : 15 ~ 17  
CN 53 - 1124 /TD ISSN 1007 - 9394  
地矿测绘  
Surveying and Mapping of Geology and Mineral Resources  
*
Python ArcPy  
地质信息处理中的基本用  
莹  
(
中国地质大学 地质调查研究北京  
100083)  
: Python  
种开在  
GIS  
ArcGIS ,  
了大的处理更高效地完  
摘要  
工具使为  
ArcGIS ArcPy 、  
地质数据的投影标准等  
地质信息处理工作 利用  
Python  
集成  
, , ,  
简单易便使为地质数据处理人便工具  
: Python; ArcGIS; ArcPy;  
关键词  
中图分类号  
地质信息处理  
: P 209; TP 311  
: A  
: 1007 - 9394( 2017) 01 - 0015 - 03  
文章编号  
文献标识码  
Basic Application of Python ArcPy in Geological Information Processing  
YE Bao-ying  
( Institute of Geological SurveyChina University of GeosciencesBeijing 100083China)  
Abstract: Python as an open source languagein the GIS softwareoften has been used as an auxiliary tool. Especial-  
ly in ArcGISit provides a large number of processing modulesmore efficient completion of geological information pro-  
cessing. The use of Python language and ArcPy software package integrated in ArcGIS is so easy to realize inputmap pro-  
jection transformation and query work of geological data. The code is simplereadable and easy to usewhich provides a  
more convenient tool for geological data processing personnel.  
Key words: Python; ArcGIS; ArcPy; geological information processing  
0
1
引言  
数据输入  
1]  
、 、  
地质地质路线生成  
Python  
C
基于 高级言  
Python  
外采的数据多为转入  
GIS  
生成线  
: ; ,  
以下简单易高级具  
件 点件  
ArcGIS 10. x desktop  
ad-  
现成工具  
Exceldbf Excel  
;
面向性  
dxydata  
工具可以为  
等格式  
件  
ArcPy ArcGIS  
处理包 其目利用  
是一套  
且高效的地理数据分析 数据管理及  
Python ArcPy  
, ,  
法设字段型 会引起错误  
dbf  
件则需要  
Python  
自动的处理工具  
Python  
Access  
, ,  
以使些  
使用  
Python  
是一用的言  
一个原  
是一态  
用于及为一次  
琐  
是  
ArcGIS  
——ArcInfo Workstaion  
本 提 了  
品  
pointlinepolygon  
generate Work-  
令  
DOS  
令  
快速功  
station  
为数据理的于  
令  
ArcPy ArcGIS  
利用  
领域的  
开发的块  
进行地质信息管理与计算分析时 对于种复杂的地质  
的  
可以使用  
, , ,  
使熟悉过程不  
GIS  
Python  
专业多  
2]  
, , 。  
错误 引起专业数据  
处理人使用的工具 但  
ESRI  
Workstaion 10  
并  
, , ,  
数据 进行处理 可以大大冗余工作 数据的  
本  
基于此 有大数据转入  
ArcGIS  
工作比  
ESRI ArcPy  
的  
处理质量  
正是问题  
Python ,  
地质数据  
简单的  
ESRI  
ArcPy  
Python  
利用 可以  
琐  
工作  
的  
投影工作  
*
: 2017 - 01 - 05  
收稿日期  
·16·  
2017  
3
年 月  
地矿测绘  
1. 1  
row =pnt. numpnt. namepoints]  
cursor. insertRow( row)  
f. close( )  
del cursor  
件生成  
先确定数据文是  
Excel csv shapefile  
txt  
可以是  
式  
生成新的文式为  
式  
可以性可以分  
1. 1. 1  
1. 2  
线 面件生成  
1  
开 如所示  
, , 、  
处理地质路线工作等信息生成线 面  
件  
, ,  
线生成相同 数据也相同 线和  
区别要求首尾合  
1. 2. 1  
线为  
1
件格式  
Fig. 1 Point file format  
Python  
线式  
txt  
体  
3
所示  
处理式 处  
可以利用  
: ; 、  
理方简单有效 要求 利用生成件 并号 名称  
2  
字段所示  
3
线件格式  
Fig. 3 Line file format  
, ( ,  
首尾相同 首尾  
) , ,  
自动线为  
txt  
图  
4
所示  
4
面文件格式  
Fig. 4 Polygon file format  
ESRI shapefile  
件 并且属字  
要求生成量  
2
件生成属性表  
中  
Fig. 2 Generating attribute table from point file  
1. 2. 2  
码  
1. 1. 2  
码  
polygon’  
生成线换  
#
取点件  
polyline。  
f = file( " D: \\soft \\yePython \\test \\points. txt" )  
f = file( " D: \\soft \\yePython \\test \\polys. txt" )  
fc = " D: \\soft \\yePython \\test \\newpoly. shp"  
#
shapefile  
确定新  
位置  
fc = " D: \\soft \\yePython \\test \\newpoint. shp"  
# define projection 3 methods code name or * . prj file  
spatiref = ArcPy. SpatialReference( " Beijing 1954" )  
# create a new shapefiles  
#
, , 、  
定义投影 种方法可以选择 投影投影以  
. prj  
投影称  
# spatiref = ArcPy. SpatialReference( 4214)  
ArcPy. CreateFeatureclass_management( " D: \\ soft \\ yePython  
\\test" " newpoly. shp" " Polygon" " " " " " " spatiref)  
# create fieldsnumname  
# attentionspatial reference name MUST be show in arcMap.  
spatiref = ArcPy. SpatialReference( " Beijing 1954" )  
#
shapefile  
件  
创建的  
ArcPy. CreateFeatureclass_management( " D: \\ soft \\ yePython  
\\test" " newpoint. shp" " POINT" " " " " " " spatiref)  
ArcPy. AddField_management ( fc" name" " TEXT" )  
# insert data records  
cursor = ArcPy. da. InsertCursor ( fc( " num" " name" "  
SHAPE@ " ) )  
#
, , ,  
加需要的字段度 别名  
ArcPy. AddField_management ( fc" num"" SHORT""""""  
arrays = ArcPy. Array( )  
")  
号  
pnt = ArcPy. Point( )  
ArcPy. AddField_management ( fc" name"" TEXT""""""  
for line in f. readlines( ) :  
")  
称  
j = line. split( )  
#
入一记录  
cursor = ArcPy. da. InsertCursor ( fc( " num" " name" "  
SHAPE@ " ) )  
pnt = ArcPy. Point( )  
for px in range( 2len( j) - 12) :  
pnt. numpnt. namepnt. Xpnt. Y = j0j1,  
jpxjpx + 1]  
printpnt. numpnt. Xpnt. Y  
for line in f. readlines( ) :  
arrays. append( pnt)  
j = line. split( )  
polys = ArcPy. Polygon( arrays)  
pnt. numpnt. namepnt. Xpnt. Y = j0j1float( j  
2) float( j3)  
row =pnt. numpnt. namepolys]  
cursor. insertRow( row)  
points = ArcPy. Point( pnt. Xpnt. Y)  

全部评论(0)

暂无评论