PROBLEM

Publishing a CSV file to ArcGIS Online as a hosted feature layer does not retain the integer field type

Last Published: September 10, 2020

Description

In some instances, publishing a CSV file as a hosted feature layer to ArcGIS Online converts an integer field type to a string field. In this example, the 'Number_of_Employees' field type is set to integer when being published to ArcGIS Online.

Image showing the Field Type for the Number_of_Employees field is set to Integer.

However, when viewing the hosted feature layer in the Data tab, the field type for the 'Number_of_Employees' field is converted to string instead, as shown in the image below.

Image showing the Number_of_Employees field type is converted from an integer field to a string field.

Cause

This issue occurs if the integer field contains string values. Since a CSV file does not store field type information, each field is automatically assigned a field type based on the field values when publishing to ArcGIS Online. Refer to Esri Newsroom: Make More Useful Layers from CSV Files for more information.

In this example, the 'Number_of_Employees' field contains two string values, 'Five thousand' and 'Nine thousand'. Therefore, the field type was assigned to string instead of integer.

Image showing the Number_of_Employees field containing two string values.

Solution or Workaround

To retain the integer field type in a published hosted feature layer, change the string values in the integer field of the CSV file to integer values using the steps below:

Note:
Adding and publishing content as a hosted feature layer to ArcGIS Online requires a Publisher or an Administrator role.
  1. From the local host machine, open the CSV file using an editor software, such as Microsoft Excel.
  2. Search for string values in the integer field. In this example, the "Number_of_Employees" field contains two string values, Five thousand and Nine thousand.
Image showing the string values for the Number_of_Employees field.
  1. Replace all the string values with integer values. In this example, Five thousand'' and Nine thousand'' are replaced with 5000 and 9000.
Image showing the string values in the Number_of_Employees field are replaced with integer values.
Note:
Remove other unnecessary string values such as periods or quotation marks, if any.
  1. Save and publish the CSV file with the updated values as a hosted feature layer to ArcGIS Online. Refer to ArcGIS Online: Publish a CSV file for steps on how to do so.
Image showing the integer field is retained after removing string values.

Article ID:000023737

Software:
  • ArcGIS Online

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Related Information

Discover more on this topic