ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • 帮助
  • Sign Out
ArcGIS Desktop

ArcGIS Online

专为贵组织打造的制图平台

ArcGIS Desktop

全面的专业性 GIS

ArcGIS Enterprise

面向企业的 GIS

ArcGIS Developers

用于构建位置感知应用程序的工具

ArcGIS Solutions

适用于行业的免费模板地图和应用程序

ArcGIS Marketplace

获取适用于组织的应用程序和数据

  • 文档
  • 支持
Esri
  • 登录
user
  • 我的个人资料
  • 登出

ArcMap

  • 主页
  • 入门
  • 地图
  • 分析
  • 管理数据
  • 工具
  • 扩展模块

CreateObject

  • 描述
  • 讨论
  • 语法
  • 代码示例

描述

用于创建地理处理对象。可使用额外的参数来指定创建对象所需的附加要求,例如 ValueTable 对象中的列数。

讨论

注:

与使用 CreateObject 相比,使用等效 ArcPy 类要更为方便和直接。例如,可使用 arcpy.Array() 来替代 arcpy.CreateObject("array")。

  • ArcSDESQLExecute
  • Array
  • Extent
  • FeatureSet
  • Field
  • FieldInfo
  • FieldMap
  • FieldMappings
  • Geometry
  • NetCDFFileProperties
  • Point
  • RecordSet
  • Result
  • SpatialReference
  • ValueTable

语法

CreateObject (name, {options})
参数说明数据类型
name

待创建的对象名称(ArcSDESQLExecute、Array、Extent、FeatureSet、Field、FieldInfo、FieldMap、FieldMappings、Geometry、NetCDFFileProperties、Point、RecordSet、Result、SpatialReference、ValueTable)。

String
options

可选参数取决于正在创建的对象。

Object

返回值

数据类型说明
Object

返回的对象取决于第一个参数中指定的对象类型。

代码示例

CreateObject 示例

使用值表来保存联合工具的要素类名称和等级。

import arcpy
# Set the workspace. List all of the feature classes in the dataset
arcpy.env.workspace = "c:/data/landbase.gdb/wetlands"
fcs = arcpy.ListFeatureClasses()
# Create the value table for the Analysis Union tool with 2 columns
vtab = arcpy.CreateObject("valuetable", 2)
# Iterate through the list of feature classes
for fc in fcs:
    # Update the value table with a rank of 2 for each record, except
    #   for BigBog
    if fc.lower() != "bigbog":
        vtab.addRow(fc + " 2")
    else:
        vtab.addRow(fc + " 1")
# Union the wetlands feature classes with the land use feature class
# to create a single feature class with all of the wetlands and land
# use data
vtab.addRow("c:/data/landbase.gdb/land_use 2")
arcpy.Union_analysis(vtab, "c:/data/landbase.gdb/wetlands_use")

相关主题

  • 通过 Python 使用类

ArcGIS Desktop

  • 主页
  • 文档
  • 支持

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

关于 Esri

  • 关于我们
  • 招贤纳士
  • Esri 博客
  • 用户大会
  • 开发者峰会
Esri
分享您的想法。
Copyright © 2021 Esri. | 隐私政策 | 法律声明