Summary
In Portal for ArcGIS or ArcGIS Online, the owner of a hosted feature layer view or an administrator can define the features available in the view using one of the three options: 'Add filter', 'Area of interest', or 'Fields'. In some cases, it is necessary to create a filtered view of the layer based on the shape from another layer. Although it is currently not possible to use another feature layer to define a feature layer view, this article describes a workaround to achieve a similar output.
In this article, a feature layer containing point features of school locations in a part of Oregon is filtered based on a polygon feature in the Washington county layer to display only the schools within the county. The image below shows the school point features in Oregon.
Procedure
Note:
If all the required layers are hosted within a single feature layer in Portal for ArcGIS or ArcGIS Online, proceed to Step 3. If the layers are hosted as single feature layers, follow the workflow from Step 1.
- In an ArcGIS Pro project, create a new map, and add the feature layer to be filtered spatially and the feature layer containing the features to define the spatial filter. In this example, the layer to be filtered is Schools, and the layer to define the spatial filter is Washington_County.
Note:
If the feature layers are hosted in Portal for ArcGIS or ArcGIS Online, download the layers to the local machine as shapefiles, and add the layers to a new, blank map in ArcGIS Pro. Refer to How To: Download publicly shared data from ArcGIS Online to the local machine as shapefiles.
- Share the map as a web feature layer to Portal for ArcGIS or ArcGIS Online. For the Layer Type parameter, select Feature. Refer to Share a web feature layer for the workflow.
- In Portal for ArcGIS or ArcGIS Online, create a hosted feature layer view from the published feature layer. Refer to Create hosted feature layer views for the workflow.
- In the Choose layers section, ensure both layers are selected. Click Next.
- In the Define view section, select the layer containing features to be filtered. In this example, the layer name is Schools.
- In the Layer definitions pane, select the Area of interest option, click the Polygon button, and trace the outline of the boundary layer. The image below shows the boundary from the layer is in black, and the drawn area of interest is in red.
- Optionally, click the arrow next to Layer definitions, click Back to go to the Choose layers section, and deselect the boundary layer to turn it off.
- To set definitions for other layers in the view, repeat Steps 3(a) through 3(c) for each layer.
- Click Next. In the Create view section, set all the parameters, and click Create to create the hosted feature layer view.
The image below shows the filtered view of school point features based on the boundary of the Washington county.