ArcGIS for Desktop

  • 文档
  • 合约
  • 支持

  • My Profile
  • 帮助
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

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

ArcGIS for Desktop

全面的专业性 GIS

ArcGIS for Server

面向企业的 GIS

ArcGIS for Developers

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

ArcGIS Solutions

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

ArcGIS Marketplace

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

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

帮助

  • 主页
  • 入门
  • 制图
  • 分析
  • 管理数据
  • 工具
  • 更多...

FieldInfo

  • 摘要
  • 语法
  • 属性
  • 方法概述
  • 方法
  • 代码实例

摘要

为图层和表视图提供字段信息方法和属性。

语法

 FieldInfo  ()

属性

属性说明数据类型
count
(只读)

The field count.

Integer

方法概述

方法说明
addField (field_name, new_field_name, visible, split_rule)

添加字段条目信息

exportToString ()

将对象导出至其字符串表示。

findFieldByName (field_name)

按字段名查找字段索引

findFieldByNewName (field_name)

按新字段名查找字段索引。

getFieldName (index)

按索引位置获取表中的字段名称。

getNewName (index)

按索引位置获取表中的新字段名称。

getSplitRule (index)

按索引位置获取表中的分割规则。

getVisible (index)

按索引位置从表中获取可见标记。

loadFromString (string)

使用对象的字符串表示来恢复对象。可以使用 exportToString 方法创建字符串表示。

removeField (index)

从表中移除字段信息条目。

setFieldName (index, field_name)

将字段名称设置到表中。

setNewName (index, new_field_name)

将新字段名称设置到表中。

setSplitRule (index, rule)

将分割规则设置到表中。

setVisible (index, visible)

设置表中字段的可见标记。

方法

addField (field_name, new_field_name, visible, split_rule)
参数说明数据类型
field_name

The field name from the input feature class or table.

String
new_field_name

Sets the field name for the new layer or table view.

String
visible

Sets whether the field is visible or hidden.

  • VISIBLE —Field is visible.
  • HIDDEN —Field is hidden.
String
split_rule

Sets the behavior of an attribute's values when a feature is split.

  • NONE —The attributes of the two resulting features take on a copy of the original value.
  • RATIO —The attributes of resulting features are a ratio of the original feature's value. The ratio is based on the division of the original geometry. If the geometry is divided equally, each new feature's attribute gets one-half of the value of the original object's attribute.
String
exportToString ()

返回值

数据类型说明
String

对象的字符串表示。

findFieldByName (field_name)
参数说明数据类型
field_name

用于查找字段索引位置的字段名

String

返回值

数据类型说明
Integer

索引位置

findFieldByNewName (field_name)
参数说明数据类型
field_name

用于查找新字段索引位置的新字段名。

String

返回值

数据类型说明
Integer

索引位置。

getFieldName (index)
参数说明数据类型
index

索引位置。

Integer

返回值

数据类型说明
String

字段名称。

getNewName (index)
参数说明数据类型
index

索引位置。

Integer

返回值

数据类型说明
String

新字段名称。

getSplitRule (index)
参数说明数据类型
index

索引位置。

String

返回值

数据类型说明
String

分割规则。

  • NONE —The attributes of the two resulting features take on a copy of the original value.
  • RATIO —The attributes of resulting features are a ratio of the original feature's value. The ratio is based on the division of the original geometry. If the geometry is divided equally, each new feature's attribute gets one-half of the value of the original object's attribute.
getVisible (index)
参数说明数据类型
index

索引位置。

String

返回值

数据类型说明
String

可见标记。

  • VISIBLE —Field is visible.
  • HIDDEN —Field is hidden.
loadFromString (string)
参数说明数据类型
string

对象的字符串表示。

String
removeField (index)
参数说明数据类型
index

字段信息对象的索引位置。

Integer
setFieldName (index, field_name)
参数说明数据类型
index

索引位置。

Integer
field_name

要设置到表中的字段名称。

String
setNewName (index, new_field_name)
参数说明数据类型
index

索引位置。

None
new_field_name

要设置到表中的新字段名称。

String
setSplitRule (index, rule)
参数说明数据类型
index

索引位置。

Integer
rule

要设置到表中的分割规则。

  • NONE —The attributes of the two resulting features take on a copy of the original value.
  • RATIO —The attributes of resulting features are a ratio of the original feature's value. The ratio is based on the division of the original geometry. If the geometry is divided equally, each new feature's attribute gets one-half of the value of the original object's attribute.
String
setVisible (index, visible)
参数说明数据类型
index

索引位置。

Integer
visible

要设置到表中的可见策略。

  • VISIBLE —Field is visible.
  • HIDDEN —Field is hidden.
String

代码实例

FieldInfo 示例

显示要素图层的 FieldInfo 属性。

import arcpy

feature_class = "c:/Data/wells.shp"
layer = "temp_layer"
arcpy.MakeFeatureLayer_management(feature_class, layer)

# Create a describe object
desc = arcpy.Describe(layer)

# If a feature layer, continue
if desc.dataType == "FeatureLayer":

    # Create a fieldinfo object
    field_info = desc.fieldInfo

    # Use the count property to iterate through all the fields
    for index in range(0, field_info.count):
        # Print fieldinfo properties
        print("Field Name: {0}".format(field_info.getFieldName(index)))
        print("\tNew Name:   {0}".format(field_info.getNewName(index)))
        print("\tSplit Rule: {0}".format(field_info.getSplitRule(index)))
        print("\tVisible:    {0}".format(field_info.getVisible(index)))

相关主题

  • TableView 属性
  • 图层属性
有关此主题的反馈?

ArcGIS for Desktop

  • 主页
  • 文档
  • 合约
  • 支持

ArcGIS 平台

  • ArcGIS Online
  • ArcGIS for Desktop
  • ArcGIS for Server
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

关于 Esri

  • 关于我们
  • 招贤纳士
  • 内部人员博客
  • 用户大会
  • 开发者峰会
Esri
© Copyright 2016 Environmental Systems Research Institute, Inc. | 隐私政策 | 法律声明