HOW TO

Use custom parameters in Map Viewer to spatially filter by polygon

First Published: September 7, 2026
Last Published: September 7, 2026

Summary

In ArcGIS Enterprise and ArcGIS Online, custom parameters can be used in Map Viewer to spatially filter data based on a custom polygon. Use this workflow when it is necessary to limit a feature layer to features that intersect a specific polygon, without creating a new derived layer or running analysis tools.

Cause

In some cases, you may want to limit the spatial extent of data but are unable to do so using a standard filter. Common scenarios include:

  • The layer does not contain an attribute field that can be used for filtering.
  • The dataset is very large and using analysis tools would consume excessive credits.
  • You need to restrict features to a specific geographic area without creating a new dataset.

Custom parameters allow filtering directly at the service level by passing a polygon geometry to the layer query. This can reduce the amount of data returned and improve map performance.

Procedure

Follow the steps below to retrieve the polygon geometry and use it in the target layer custom parameters.

  1. Determine the polygon to use as the filter:
    Identify the polygon that defines the spatial filter. In this example, a state boundary layer is used to obtain the geometry for Iowa. The goal is to filter a large bridge condition dataset so that only features within Iowa are returned.

polygon that defines the spatial filter

state boundary layer used to obtain the geometry for Iowa

  1. Find the polygon ObjectID:
    Open the polygon layer in Map Viewer, go to the Data tab, enable the OBJECTID field through Column Visibility, and note the ObjectID value for the selected polygon. In the example, Iowa has an OBJECTID of 16.

ObjectID value for the selected polygon from table of US States Generalized Boundaries

  1. Retrieve the polygon geometry from the REST service:
    Open the layer Item Details page, select View under the layer URL, select the polygon layer in the REST Services Directory, and use the Query operation. Enter the ObjectID, set Format to JSON, and select Query (GET).

Entering the OblectID in the ArcGIS REST Services Directory

Selcting SQL Query (GET) and JSON formats in the ArcGIS REST Services Directory

  1. Copy the geometry information:
    From the JSON response, capture the spatialReference wkid value and the geometry rings array. The rings array contains the polygon vertices used as the spatial filter geometry. 

JSON showing the wkid value and the geometry rings array

  1. Configure custom parameters in Map Viewer:
    Open the layer to filter, open the Properties pane, scroll to Custom parameters, and select Add parameter to add each of the required parameters: geometryType, spatialRel, and geometry.

adding the parameters to filter the layer by geometryType, spatialRel, and geometry

Parameter 

Value 

geometryType 

esriGeometryPolygon 

spatialRel 

esriSpatialRelIntersects 

geometry 

Polygon rings JSON with matching spatialReference wkid (see below) 

{ 
  "rings": [ 
    [ 
      [-91.1201324198553, 40.7054431242584], 
      [-91.1293029781382, 40.6821890161974], 
      [-91.1626444205684, 40.6563524249651], 
      [-91.2150600067229, 40.6438594146109] 
      // Additional vertices omitted for brevity 
    ] 
  ], 
  "spatialReference": { "wkid": 4326 } 
}  

The geometry value must contain the complete rings array copied from the REST query results. The sample above is abbreviated for readability. Ensure the geometry parameter includes the spatialReference wkid returned by the REST query.

  1. Verify the results:
    After the parameters are applied, the layer query is limited to features that intersect the polygon. In this example, the bridge condition layer is restricted to features intersecting Iowa.

verifying the layer query is limited to features that intersect the polygon

Article ID: 000042856

Software:
  • ArcGIS Online
  • ArcGIS Enterprise

Get support with AI

Resolve your issue quickly with the Esri Support AI Chatbot.

Start chatting now

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Start chatting now

Go to download options