One of the new features we’ve introduced in the recent update of ArcGIS Online is the ability to add and delete fields from your hosted layers directly within Map Viewer. Whether you need to quickly add a field to calculate new values or delete a field that is no longer needed in your dataset, we’ve got you covered.
Who can add and delete fields?
To add or delete fields in Map Viewer, you must be the layer owner, organization administrator, or a member of a shared update group the item is shared with. This option is available for both hosted feature layers (including Oriented Imagery Layers) and hosted tables.
Limitations for adding and deleting fields
In specific cases, you still may not be able to add or delete fields. In the following scenarios, adding or deleting a field is not supported:
- The layer has a related tile layer (vector or raster)
- The layer is a hosted feature layer view
- The layer participates in a joined view (or is a joined view feature layer)
- The layer is hosted spatiotemporal feature layer
Adding fields
At the bottom of the Fields pane, there will now be an option to Add field. Clicking this button opens the new add field experience. You will then need to select what type of field you want to add to your layer. The available field types are separated into general categories based on the type of data they can contain (text, numbers, etc.).
After you’ve selected the field type, select Next to fill out your field parameters. The parameters shown in this step will vary depending on the selected field type. For example, the length parameter is only applicable to string fields. Some of the parameters are optional, and this is indicated in the text above each input. You must ensure all non-optional parameters are filled out before you can successfully add the field to your layer.
Global identifier fields
You may have already noticed that there is a category in the field type selection page titled Global identifiers. Expanding this section will reveal two field types: GUID (globally unique identifier) and GlobalID. While these field types aren’t new to the ArcGIS platform, this is the first time they’ve been offered in the add field experience in ArcGIS Online. While both the GUID and GlobalID field types are used to identify features in your dataset, there are some key differences between the two.
GlobalID
GlobalIDs are system-maintained fields that uniquely identify a feature in your layer. When this field is added to a layer with existing data, GlobalIDs for the existing features will be automatically populated. Once added, this field cannot be edited or deleted from your layer. A hosted layer or table can only contain a single GlobalID field. As a result, if your layer already has a GlobalID field, this field type will be unavailable for selection.
GUID
GUID fields will not be automatically populated for your existing data, or any new features that you may add. To easily populate a GUID field we recommend using Arcade’s Guid() function to calculate the value in a form. Unlike a GlobalID field, you are not restricted to only having a single GUID. GUID fields are also not required to be unique within your layer. Because they are often used as the foreign key in relationships, multiple features within a layer may have the same GUID.
Setting a field value type
Setting the field value type is a new optional parameter available for all field types, except for GlobalIDs. You can think of the field value type as metadata about your field. It provides additional context as to what sort of data is contained in the field. This is particularly helpful if your dataset is being consumed by others who may not be as familiar with it. If a field is used to style a layer, the field value type can be used to determine the most appropriate style for your layer based on the selected field(s). In addition to setting this information on field creation, you can also edit field value types for your layer or table via the Fields panel in the Data tab on the item details page.
Deleting fields
To delete a field, select it from the fields pane to open the Manage field window. If the field is eligible for deletion, you will see an option in this window to Delete field.
Some fields are not eligible for deletion for data integrity reasons. This is primarily to prevent deleting a field that could corrupt existing web maps that use the layer or table. For example, fields used to style or filter the layer, or those being actively used to label in the web map cannot be deleted. Other fields that are not eligible for deletion via the Fields pane include:
- The layer’s display field (displayField)
- Fields that contain the subtype ID (subtypeField) or type ID (typeField) for a layer
- Fields used to establish relationships in the layer (keyField)
- System-maintained fields (ObjectIDs, geometry fields, editor tracking fields, GlobalIDs)
- Fields that are used to configure time awareness on the layer (timeInfo fields)
- The search field configured in a saved web map (only within the context of that web map)
You should always be cautious when deleting fields from a layer or table, particularly if you are not the layer owner. If your layer is shared publicly, there could be other web maps not owned by you that are leveraging your layers and/or tables.
Bulk deletion of fields is not supported in this workflow. If you need to delete multiple fields at once, you must go to the item details page for your layer and delete the fields via the Fields panel in the Data tab.
Summary
The ability to add and delete fields in Map Viewer is just one of the many enhancements we’ve made in this update of ArcGIS Online. Make sure to check out the some of the other blogs we’ve released to explore other new features. Also, keep an eye out for the new add and delete experience to eventually make its way to the Data tab in the layer’s item details page.
Happy Mapping!
All Adobe Stock images are © 2024 Adobe Stock. All rights reserved.
Article Discussion: