返回要素数目。 >>> result = arcpy.GetCount_management("streets_50m_of_rivers") >>> print result.getOutput(0) 54 返回要素类的默认空间格网索引列表。 >>> result = arcpy.CalculateDefaultGridIndex_management("streets_50m_of_rivers") >>> for i in range(0, result.outputCount): ... print ...
\Work\doing\CNN_RNN\data\processdata" # 设置工作路径 arcpy.env.outputCoordinateSystem = prjfile arcpy.env.extent = "MAXOF" # 设置范围 # arcpy.env.extent = arcpy.Extent(454871.698900, 4253992.158900, 624251.698900, 4437472.158900) # "XMin, YMin, XMax, YMax" arcpy.env.extent = envfile # ...
arcpy.Buffer_analysis()exceptarcpy.ExecuteError:print(arcpy.GetMessages())#捕捉警告try: arcpy.SetSeverityLevel(1) arcpy.Buffer_analysis()exceptarcpy.ExecuteError:print(arcpy.GetMessages()) 环境(Environment)设置 arcpy.env.workspace = “c:/data“#设置工作空间arcpy.env.extent = arcpy.Extent(0,0,10...
# 需要导入模块: import arcpy [as 别名]# 或者: from arcpy importSpatialReference[as 别名]defcreatePolygon(self, lat, lon, extent, out_polygons, scratchWorkspace):"""Create a Thiessen polygon feature class from numpy.ndarray lat and lon Each polygon represents the area described by the center ...
arcpy.Clip_analysis("streets", result,"streets_50m_of_rivers") Возвращаетсяколичествопространственныхобъектов. result = arcpy.GetCount_management("streets_50m_of_rivers")# prints 54print(result[0]) ...
Tools produce messages, accessed through a variety of functions such asGetMessages(). Functions do not produce messages. Running a tool This next example shows how to execute theBuffertool. When run in the Python window, the code will be transferred into the transcript section of the window al...
arcpy.GetCount_management("E:\\pythondata\\shengdao.shp") arcpy.GetCount_management(r"E:\pythondata\shengdao.shp") 输出结果: <Result '1509'> 2、可选参数 --添加字段 # 将可选参数设置为一组空双引号 ("") arcpy.AddField_management("c:/data/streets.shp", "Address", "TEXT", "", "...
SpatialReference和Extent类,通常用作地理处理工具参数设置的快捷方式,否则的话,这些参数会使用更加复杂的字符串。类的作用类似于建筑设计蓝图。蓝图为如何创建事物提供了一个框架,而类则可用来创建对象,即通常所称的实例。 importarcpyspatial_ref=arcpy.SpatialReference("Hawaii Albers Equal Area Conic") ...
arcpy.CreateFeatureclass_management(os.path.dirname(out_fc), os.path.basename(out_fc),"POLYGON", spatial_reference=out_sr) arcpy.AddField_management(out_fc,"dataset","TEXT",400)# add each dataset's extent & the dataset's name to the outputwitharcpy.da.InsertCursor(out_fc, ("SHAPE@",...
ArcPy 类,如 SpatialReference 和 Extent类,通常用作地理处理工具参数设置的快捷方式,否则的话,这些参数会使用更加复杂的字符串。 ArcPy 函数 函数是用于执行某项特定任务并能够纳入更大的程序的已定义功能。 在 ArcPy 中,所有地理处理工具均以函数形式提供,但并非所有函数都是地理处理工具。除工具之外,ArcPy 还提供...