博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
【C013】ArcPy - 入门学习
阅读量:6910 次
发布时间:2019-06-27

本文共 3193 字,大约阅读时间需要 10 分钟。

加入字段:

 

>>> arc = ['A','B','C','D','E']>>> for i in range(5):...     arcpy.AddField_management("idcounty",arc[i],"TEXT")

给idcounty空间数据批量加入五个字段~

 

Buffer缓冲区

arcpy.Buffer_analysis("thermal","buffer","10 kilometers")

集合面积与几何长度

 

 

>>> arcpy.CalculateField_management("idcounty","ID_Area","!shape.area@squarekilometers!","PYTHON_9.3")
>>> arcpy.CalculateField_management("idcounty","ID_Area","!shape.length@kilometers!","PYTHON_9.3")

改变工作空间

 

 

>>> arcpy.env.workspace = "F:/Data">>> result = arcpy.Buffer_analysis("thermal","t_Buffer","10 kilometers")>>> print resultF:/Data\t_Buffer.shp

返回要素数目

 

 

>>> result = arcpy.GetCount_management("idcounty")>>> print result.getOutput(0)44

调用工具的方法,就是工具的英文名称,去掉中间的空格,然后下划线,加入工具集的名称

字段名称:

 

>>> fieldList = arcpy.ListFields("idcounty")>>> for field in fieldList:...     print field.aliasname + field.type

获取工作空间内所有要素类的字段名:

 

 

>>> fes = arcpy.ListFeatureClasses()>>> for fe in fes:...     print fe ...     nl = ''...     fs = arcpy.ListFields(fe)...     for f in fs:...         nl = nl + '  ' + f.aliasName...     print nl

复制(工作空间中的可以直接写名字)

 

arcpy.Copy_management("i_Copy.shp","F:/Data/data/qq.shp")

列表的一些函数

>>> a = [1]*10>>> for i in range(10):...     a[i] = i... >>> a[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]>>> b = [1]*2>>> b[1, 1]>>> a.extend(b)>>> >>> a[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 1]>>> a + b[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 1, 1, 1]>>> a [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 1]>>> a.count(1)3>>> a.append(100)>>> a[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 1, 100]>>> a.index(100)12>>> a.insert(0,'I')>>> a['I', 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 1, 100]>>> a.pop(0)'I'>>> a[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 1, 100]>>> a.remove(100)>>> a[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 1]>>> a.reverse()>>> a[1, 1, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]>>> a.sort()>>> a[0, 1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9]>>>

Python数据类型

 

>>> type(3)
>>> type(3.0)
>>> type(1111111111)
>>> type(111111111111111)
>>> type(3.00000000)
>>> type(3.000000000000)
>>> type(1+2j)
>>> type(True)
>>> type('Alex')
>>> type([2,4])
>>> type((3,4))
>>>

详见:

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

------------------------------------------------ ESRI培训 ----------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

地图文件mxd

 

>>> mxd = arcpy.mapping.MapDocument("current")>>> print mxd.filePathF:\MY_OWN_WORK\Exercise\中国.mxd

数据框架data frame

 

>>> mxd = arcpy.mapping.MapDocument("current")>>> dfs = arcpy.mapping.ListDataFrames(mxd)>>> for df in dfs:...     print df.name... 图层Data Frame II

图层layer

 

 

>>> mxd = arcpy.mapping.MapDocument("current")>>> df = arcpy.mapping.ListDataFrames(mxd)[0]>>> ls = arcpy.mapping.ListLayers(df)>>> for l in ls:...     print l ... Cities (population > 5 Million)GeogridRiversLakesContinentsOcean
dataframe.extent = layers[0].getSelectedExtent()

 

 

 

 

 

 

转载地址:http://cxfcl.baihongyu.com/

你可能感兴趣的文章
Cocos2d-x之内存管理
查看>>
Sharepoint 列表分页开发
查看>>
当页面是本地页面时,通过ajax访问tomcat里的action,传递的参数在action里并不能识别...
查看>>
设计模式6大原则
查看>>
C# WinForm : 自定义分页控件
查看>>
RocketMQ Java 客户端实现
查看>>
hdu 1133 Buy the Ticket (大数+递推)
查看>>
java:Java里数字转字符串前面自动补0的实现
查看>>
获取图片颜色的rgb,以供css设计背景颜色
查看>>
org.tinygroup.validate-验证框架
查看>>
人脸识别中的harr特征提取(转)
查看>>
wxPython 入门开发示例
查看>>
Windows 8 Metro App开发[6]访问Assets文件夹
查看>>
Cpython的全局解释器锁(GIL)
查看>>
session共享方法
查看>>
ASP.NET AJAX web chat application
查看>>
14--Rails的ActiveView2
查看>>
UVa 496 - Simply Subsets
查看>>
java基础思维导图大全
查看>>
C# 面向对象7 命名空间
查看>>