If you want to allow clients to change layer appearance and behavior in your map service, you can enable dynamic layers at the time you create the map service or after you've already published the map service. Dynamic layers can increase the amount of interaction that users are able to have with your maps. The way you enable dynamic layers is through the Service Editor in ArcMap.
To enable dynamic layers on your map service, follow these steps:
- Display the Service Editor for the map service on which you want to enable dynamic layers. When you're creating a new map service, you'll see the Service Editor before you finish publishing. When you're modifying an existing service, you can display the Service Editor by right-clicking the service in the Catalog tree and choosing Service Properties.
- Click the Mapping tab and select Allow per request modification of layer order and symbology.
If you want to dynamically add layers to your map service in a client application, you'll need to select workspaces that contain the layers you want to add.
- Click Manage.
- If a dynamic workspace you want to use is not listed in the Manage Dynamic Workspaces dialog box, add a new dynamic workspace by clicking Add.
- In the Add Dynamic Workspace dialog box, choose the type of workspace you want to add from the Workspace Type drop-down list. You can choose between enterprise databases, file geodatabases, folders containing shapefiles, and folders containing raster datasets.
The Workspace ID is automatically populated based on the workspace type. When a client requests to add a layer in an application, the ID is included in the request. This is used to identify the workspace from the pool of available workspaces.
- Optionally, change the workspace ID. The ID can be any string of characters and contain spaces.
- Navigate to the workspace you want to use by clicking the ellipsis (...) button. Based on the type of workspace you selected, you'll be presented with the following options:
- If you selected Enterprise Database, locate the database connection you want to use and click Select. Additionally, you have the option of creating a new database connection to use as your dynamic workspace.
- If you selected File Geodatabase, locate the geodatabase you want to use and click Select. Additionally, you have the option of creating a new file geodatabase to use as your dynamic workspace. Keep in mind that you'll need to add feature classes and/or tables to that file geodatabase at a later time.
- If you selected Raster Folder, choose the folder that contains the rasters you want to use and click Select.
- If you selected Shapefile Folder, choose the folder that contains the shapefiles and/or dBASE files you want to use and click Select.
- On the Add Dynamic Workspace dialog box, review your workspace parameters and click OK. If you selected an enterprise database as your workspace, you can optionally lock the database version that users can access by choosing Lock Version.
- Click OK.
Your map service is now configured with dynamic layers enabled. Supported clients will be able to change layer appearance and behavior dynamically.