This sample illustrates how to develop an SOI to apply certain spatial restrictions on the Export Map, Identify, and Find REST operations of a map service. It contains two sample SOIs, Clipping SOI and SpatialFilter SOI. Clipping SOI masks out layers outside of a clip polygon to draw or query, whereas SpatialFilter SOI draws or queries only features that meet the spatial filter criteria defined from the SOI. The spatial restriction logic provides a fine-grained resource access control with the support of spatial factors.
Note : This sample SOI is only applicable to map services published from ArcGIS Pro to a 10.8 or later versions of ArcGIS Server. See what's new in the ArcGIS REST API at 10.8.
Deploying the SOI from the .soe file (../SpatialRestrictionSOI/target/SpatialRestrictionSOI.soe
) does not require you to open a Java IDE. However, you can open the project (../SpatialRestrictionSOI
) in a Java IDE, such as Eclipse or IntelliJ, to debug, modify, and recompile the SOI project.
Features
- Preprocess REST requests
- Spatial Filter
Sample data
This instruction uses the USA map service as the sample service to test with the SOI.
Instructions
Deploy the SOIs
-
Log in to ArcGIS Server Manager and click the Site tab.
-
Click Extensions.
-
Click Add Extension.
-
Click Choose File and choose the SpatialRestrictionSOI file (
../SpatialRestrictionSOI/target/SpatialRestrictionSOI.soe
). -
Click Add.
Enable the Clipping SOI on a map service
- Make sure you have published the USA map service using ArcGIS Pro. If not, refer to USA map service
- Log in to ArcGIS Server Manager and click the Services tab. Select USA map service and select Capabilities.
- In the Interceptors section, select Java Clipping SOI in the Available Interceptors box and click the right arrow button to move it to Enabled Interceptors.
- Click the Save and Restart button to restart the service.
Test the Clipping SOI
-
Open a browser and navigate to the REST services endpoint of the USA map service (URL:
http://<serverdomain>/<webadaptorname>/rest/services/USA/MapServer
). -
Scroll to the bottom of the above page and click Export Map in Supported Extensions.
This leads you to the following URL:
http://<serverdomain>/<webadaptorname>/rest/services/USA/MapServer/export?bbox=-178.85719640187426,13.522152002873426,-56.484036397641795,81.72479317856566
The exported image shows the map in a circle area. Alternatively, try to view this map service in ArcGIS JavaScript or ArcGIS Online Map Viewer and you should see similar result:
-
You can play around the Export Map, Identify and Find operations to observe the SOI's effects.
Enable the SpatialFilter SOI on a map service
- Navigate back to the USA map service in ArcGIS Server Manager.
- In the Interceptors section, select Java Clipping SOI in the Enabled Interceptors box and click the left arrow button to disable this SOI.
- Select Java SpatialFilter SOI in the Available Interceptors box and click the right arrow button to move it to Enabled Interceptors.
- Click the Save and Restart button to restart the service.
Test the SpatialFilter SOI
-
Open a browser and navigate to the REST services endpoint of the USA map service (URL:
http://<serverdomain>/<webadaptorname>/rest/services/USA/MapServer
). -
Scroll to the bottom of the above page and click Export Map in Supported Extensions.
This leads you to the following URL:
http://<serverdomain>/<webadaptorname>/rest/services/USA/MapServer/export?bbox=-178.85719640187426,13.522152002873426,-56.484036397641795,81.72479317856566
The exported image shows the map in a limited area. Alternatively, try to view this map service in ArcGIS JavaScript or ArcGIS Online Map Viewer and you should see similar result:
-
You can play around the Export Map, Identify and Find operations to observe the SOI's effects.