Make More Useful Layers from CSV Files

This article provides tips for creating more useful hosted feature layers from comma-separated value (CSV) files. While these tips refer to ArcGIS Online, most of them also apply to publishing CSV files as feature layers to an instance of Portal for ArcGIS.

Data Formats and Field Types

Geographic data formats such as the file geodatabase and shapefile have defined field types for each attribute field (e.g., text, numeric, date). When you upload one of these sources to ArcGIS Online, the data types in the source data are used for the fields in the resultant web layer.

However, a CSV file is a basic format that does not contain field types for the columns of information it stores. When you publish simple tabular data from a CSV file to ArcGIS Online, each column of data will be assigned a field type in the resultant web layer.

Choose the best field types for your CSV files during publication so you won't have to adjust field formatting settings later.

Field types are important. They determine how the information in a field is displayed and what capabilities are available for the field or the layer. For example, numeric fields can be included in pop-up charts, while date fields can be used to enable time on a layer. Field types also determine which Smart Mapping options are available; for instance, Counts and Amounts options are only available for numeric fields.

Here are guidelines for each field type used in ArcGIS Online that includes the information best suited to each type.

Use the string format for text fields with mixed alphanumeric characters as well as ZIP codes, FIPS codes, numeric IDs, telephone numbers, and any field that should not be displayed as a number with comma separators or decimal places. For example, the ZIP code 83706 should not be shown as 83,706 or 83,706.00.

Use the integer format for numeric fields that represent a count (e.g., population figures, the number of cars) or other whole-number or integer values (such as budget figures provided as whole dollar amounts). By default, integer fields display comma separators and no decimal places.

The double format is appropriate for numeric data that will have decimal places such as averages or normalized fields. The default display format is two decimal places with comma separators.

Use the date format for data that contains dates and/or times. This field type will allow the layer to be time enabled and has various date/time formatting options.

Publishing Feature Layers to ArcGIS Online

ArcGIS Online evaluates the first few rows of data in a CSV file to determine which field type to use for the resultant hosted feature layer. The field type can also be established if the field name matches the common field names associated with specific field formats shown in TableĀ 1.

Table 1: Common field names associated with specific formats

Other field names may be recognized when geocoding in locales other than the United States. For example, “prefecture” will match if the selected country is Japan.

ArcGIS Online does a good job choosing field types for CSVs, but there are some cases where you may need to override the suggestions. For instance, a ZIP field in your CSV might be named “Office ZIP+4 Code” or something else that ArcGIS Online doesn’t recognize. Another case is when a field that contains dates is set as string. In that case, the Enable Time option is not available for the layer.

Create a layer for collecting information more easily using the data collection templates available from ArcGIS Online.

If you choose the best field types during publication, you won’t have to adjust field formatting settings later, and you’ll ensure the desired styling and configuration options will be available on the resultant layer.

To pick field types for a CSV dataset, publish the file using the Add Item button on the My Content page. Then review the field types in the list and click any types that you want to change to select a different type.

You can always add or remove fields later using the Add/Remove Fields tool in the Table view or change the service schema if you have admin rights to the layer.

You also need to set the fields that are used to geocode your data under the Location Fields column. Most fields used for location (street, city, country) will be set to String type in the resultant feature service, except X, Y, Lat, or Long, which will be set as Double type.

More Tips

Change the name of your CSV file to something readable and identifiable before uploading it.

Revise the field names in your CSV so they are short and readable. It’s okay to include spaces because ArcGIS Online will use field names with spaces as field aliases.

You don't need a Developer account to create feature layers from scratch at the ArcGIS for Developers website. Just log in to your ArcGIS Online organizational account.

If you are creating a layer for collecting information, the data collection templates available from ArcGIS Online provide an empty feature layer with a focused set of fields and field types that can simplify the layer configuration in some cases. To use these templates, log in to your ArcGIS Online account and go to My Content > Create > Feature Layer and choose an appropriate template from the From Template tab.

You can also create a new, empty feature layer based on the schema of an existing service by going to My Content > Create > Feature Layer and clicking the From Existing Layer tab.

Create feature layers from scratch at the ArcGIS for Developers ( website. You don’t need a Developer account to use this site. Log in with your organizational account, click Hosted Data (the cylinder icon at the top right of the page), then click NEW FEATURE SERVICE and enter the information to define your new feature service.

About the author


Owen Evans is a solution engineer with the Esri national government sales team located just outside Washington, DC. He has been with Esri since 2004, and his main areas of interest are ArcGIS for Server, cloud computing, and online GIS. He contributes to the ArcGIS Online and ArcGIS for Server blogs and collaborates with the Esri Story Map team on projects and best practices documents.