操作方法

操作方法:在 ArcGIS Pro 中更改现有字段的数据类型

Last Published: July 18, 2023

摘要

In ArcGIS Pro, when creating a feature class and table, a data type is selected for each field. Data types include number types, text types, date types, binary large objects (BLOBs), or globally unique identifiers (GUIDs). In some cases, it is desirable to change the data type of certain fields, after the table or feature class is created, to manage data storage, facilitate analysis, and for data management.

过程

There are two options available to change the data type of an existing field in ArcGIS Pro. The first option is to create a new field with a desired data type, and to transfer attribute data from the existing field to the new field using the Calculate Field tool. The second option is to use the Feature Class To Feature Class tool to output a new feature class, including its respective attribute table and fields, with the desired data type.

Use the Calculate Field tool

Create a new field and populate it with the attribute data from an existing field using the Calculate Field tool. Use the workflow below to change the data type from Double to Float.

  1. In the Contents pane, right-click the feature layer, and click Attribute Table.
  2. In the attribute table, click Add The Add Field icon.. Create a new field with the desired data type in the feature layer attribute table. Refer to ArcGIS Pro: Create a field and apply a domain and default value for instructions. In this example, the data type is Float.
  3. Open the Calculate Field tool.
  4. In the Input Table section, select the desired feature class. In this example, the feature class is SimpleBuildings.
  5. In the Field Name (Existing or New) section, select the field with the Float data type created in Step 1. In this example, the field is NewField.
  6. In the Expression section, under Fields, double-click the field with the attribute data to be transferred to NewField. In this example, the existing field with the Double data type is Shape_Area. The expression NewField = !<Shape_Area>! is populated.
  7. Click Run.
Calculate Field tool.

The attribute data from the field with Double data type is transferred to the new field with the Float data type.

Field data type is changed to float.
Note:
For example workflows to change data types from text to number and vice versa, refer to How To: Convert a string field to a numeric field.

Use the Feature Class to Feature Class tool

Create a new feature class and attribute table with a new data type using the Feature Class to Feature Class tool. Use the workflow below to change the data type from Long Integer to Short Integer.

  1. Open the Feature Class to Feature Class tool.
  2. In the Parameters section, specify the desired feature class for Input Features. In this example, the feature class is Roads.
  3. Specify a desired geodatabase for the Output Location.
  4. Specify a name for the Output Feature Class. In this example, the name is FIPS26_Short_to_Long.
Feature class to feature class tool.
  1. Expand Fields, in the Field Map section, under Output Fields, select the desired field with the Long Integer data type. In this example, the field is FIPS26.
  2. Click the Properties tab. In the Type section, select Long (32-bit integer).
  3. Click Run.
Feature class to feature class tool.

The data type of the FIPS26 field is changed from Short Integer to Long Integer in the new feature class.

Short integer data type is changed to long integer data type.
Note:
It is not possible to change the data type from text to numeric, and vice versa using the Feature Class To Feature Class tool. Refer to ArcGIS Pro: 001156: Failed on input OID <value>; could not write value '<value>' to output field <value>. for more information.

文章 ID: 000023089

接收通知并查找新问题或常见问题的解决方案

从我们全新的 AI 聊天机器人中获得简明答案和视频解决方案。

下载 Esri 支持应用程序

相关信息

发现关于本主题的更多内容

获取来自 ArcGIS 专家的帮助

联系技术支持部门

下载 Esri 支持应用程序

转至下载选项