ArcGIS Blog

Tips for creating hosted feature layers

Feature layers are often the best type of layer to use for visualizing your vector data in web maps. They are easily placed on top of tiled basemaps for geographic context and support interactive queries and selection, on-the-fly styling, and pop-ups.

This post describes several tips for creating better, more useful hosted feature layers from CSV files. While the tips refer to ArcGIS Online, most of them also apply if you are publishing a feature layer 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, etc.). When you upload one of these sources to ArcGIS Online the data types in the source data are used for the fields in the resulting web layer.

A CSV file, however, is a basic format that does not contain field types for the columns of information it stores. So, when you publish simple tabular data from a CSV to ArcGIS Online each column of data will be assigned a field type in the resulting web layer (more on how that happens later in this post).

Field types are important since they determine how the information in that 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 is only available for numeric fields.

ZIP code incorrectly formatted as an integer

Below is a list of field types used in ArcGIS Online and the information best suited for each type:

Publishing feature layers to ArcGIS Online

ArcGIS Online looks at the first few rows of data in a CSV file to determine which field type to use for the resulting hosted feature layer (see Publish features in the help for more details). A field type can also be established if the field name matches any of these common field names:

Other field names may be recognized when geocoding in locales other than the US; 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; if this happens the Enable Time option won’t be available for the layer. 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 resulting 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 on 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 use this workflow to update it.

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, etc.) will be set to String types in the resulting feature service, except X, Y, Lat, or Long, which will be set as Double.

More tips for making feature layers

For more information

About the author

Owen is the lead product engineer for ArcGIS StoryMaps and has been with Esri since 2004. Before joining the StoryMaps team, he spent 11 years as a solution engineer on Esri's National Government team helping people understand the value and utility of geospatial thinking.


Next Article

What's New in ArcGIS Enterprise 10.9: Administrative Reports

Read this article