When you expose a dataset for web editing, you open it to users who may be new to GIS, or who may be using a wide variety of devices unsuitable for lengthy attribute editing sessions. You can make the job easier for them and preserve your data integrity by carefully preparing feature templates.
Feature templates define categories of items that editors are allowed to add to a feature layer, based on specific combinations of attributes. For example, feature templates for a schools feature layer might allow editors to choose whether a new feature should be classified as an elementary school, middle school, or high school. The feature layer administrator can preset the school type attribute for these three options. This ensures that editors do not enter invalid values for this important attribute.
If you use unique symbology, you can define subtypes on the feature types, which are additional templates based on other feature attributes. For example, you could define available pipeline types based on both the diameter of the pipe and the material that constitutes it. Well-defined feature templates help your editors add only the types of features that are allowed. Using feature templates, you can provide a focused palette of valid feature types for editors to create and modify.
If all the features in your layer exhibit similar characteristics or cannot easily be placed into nominal or ordinal categories, you may not need to worry about templates. For example, if you're digitizing polygon boundaries of uniquely named study areas, templates may not be necessary. However, if each study area will be placed in a priority category, then templates may be useful.
You can define feature templates in ArcGIS Pro, ArcMap, or in the map viewer.
Create feature templates in ArcGIS Pro
If you publish a hosted feature layer from a project in ArcGIS Pro, define a feature template in the project. See Create a feature template in the ArcGIS Pro help for more information. The feature templates persist when you publish the feature layer and allow editing. Anyone editing the hosted feature layer can work with the feature templates you originally defined with ArcGIS Pro.
Create feature templates in ArcMap
If your hosted feature layer originates from a map document, you can use ArcMap to define a feature template. This process is described in the ArcMap help Editing section under Using feature templates. The feature templates persist when you publish the feature layer to Portal for ArcGIS and allow editing. In the map viewer and other clients, editors will be able to work with the feature templates that you originally defined with ArcMap.
Create feature templates in the map viewer
You can also define feature templates in the map viewer. This is especially useful if you published your feature layer from a CSV file or shapefile, as these have no associated template information.
The following steps explain how you can create or modify feature templates for a hosted feature layer. It's assumed that you have published the feature layer using a shapefile or CSV file. (If you published using , ArcMap you should have already defined the templates there.)
- Enable editing on the hosted feature layer and adjust the editing settings to ensure that editors are allowed to add features.
- On the feature layer's item page, click Open in Map Viewer and click Add layer to new map.
The feature layer opens in a new map.
- Set up the symbology for your layers as you would like it to appear in the template. In most cases, this involves configuring unique symbols based on a field in your data. The values in this field will define the feature types available to editors.
- Click Edit. The default templates for the feature layer appear on the left side of the map.
- Click Manage.
You can only see this button if you're the owner of the feature layer or if you are an administrator in your organization.
- In the drop-down list, click the name of the layer that has the feature types you want to manage.
You'll see a list of the feature types and their templates. You can click the small arrow to the right of the template name to reorder the template's position in the list or set the template's properties. The most important property you will edit is the set of field values associated with the template.
Each feature type can have multiple templates that further predefine the attributes of the feature. In the following example, each school type has two templates: one for a public school and one for a private school. These translate into more feature choices in the editing environment.
To add a new template, you can click the arrow to the right of a feature type name and click New Template. This adds a new template under the feature type. You must specify the properties of the new template. For example, you could click the arrow next to High schools, click New Template, name the template Charter high school, and provide all the other relevant properties for this new template.
Another way to add a new template is to click the arrow to the right of an existing template and click Copy. This also adds a new template under the feature type, but the new template has all the same properties of the template you copied. This is useful if most of the properties for the new template are the same as the one you copied.
- To add a new type of feature, click the Add New Type of Feature button.
The most important thing you will do in this pop-up is set the attribute value that will define this feature type. For example, if you want to add a feature type for alternative schools and your data has a Type field, you could define a template for the case where the Type field equals Alternative.
You can only add a new feature type if you are using unique symbology.
- Click Save Changes when you are done updating the feature types and templates. Your changes are saved to your hosted feature layer.
You'll see the changes next time you edit features in the map viewer or any other client that supports editing feature layers.
Considerations for feature templates
- If you change the style on the layer to use unique symbols instead of color or size, the types and templates are automatically updated after a warning message. Feature types and templates are also automatically updated if you change the field of a unique value renderer.
- If only default feature templates exist, the feature template name is the same as the feature type name. You can change the template name by updating its properties.
- If your hosted feature layer has a single symbol or class breaks renderer, the service only uses feature templates, not feature types. You can change the default template and add additional ones if you want.
- You can remove all feature templates from a feature type but, if you do, editors cannot add features to the map. There are more effective ways to restrict editing, as described in Manage hosted feature layers.