Web Designer provides options to enable/disable identify operations on layers. But those settings apply broadly to all identify operations. You might have cases where you'd prefer to set up multiple identify tools that each have different behaviour. For example, you might want one identify tool that just queries Buildings, and another that queries Water Lines and Hydrants. Here is how that can be configured.
- Open your app in Web Designer
- Go to the Map component configuration
- In the "Layer Extensions" section, navigate into the layer that you will want your identify tool to use. Note: if your layer is nested inside groups or is a sublayer inside a map service, you'll want to navigate through those until you reach the layer/sublayer of interest.
Click the gear icon at the top-right corner of Web Designer, copy the value, and paste it to another location like Notepad to use later
Note: in this example the layer has a tidy value, but in many cases you'll see random letters and numbers in the value, like item://layer-extension/4e736d73-4745-4b02-b3a2-0a651d9f8563
- Go back to the main Components panel, and select the menu or toolbar where you'll want to add your new targeted identify button
- Add a new menu item and select the identify command
- Update the name and icon to indicate that this is a targeted version of the identify tool
- Click the "Customize" button to the right of the command name and pencil icon
In the custom command chain JSON that appears, replace this line:
"tasks.identify",
with:
{ "name": "tasks.identify", "arguments": { "maps": null, "sources": [ "item://layer-extension/victoria-buildings" ] } },
- Replace item://layer-extension/victoria-buildings in the pasted value with the layer or sublayer extension value that you obtained in step 4
- Click anywhere outside of the Custom Command text area to apply the change
- Test the tool
If you want to create a targeted identify tool that uses multiple layers, you would list them all in the "sources" array. Each one should be surrounded by double quotes, and they should be separated by commas. Here is a full example of a command chain that targets the Water Lines and Fire Hydrants layers in the "Web GIS - Default" demo app template:
[ { "name": "sketching.capture-geometry", "arguments": { "geometryType": [ "point", "extent" ] } }, { "name": "tasks.identify", "arguments": { "maps": null, "sources": [ "item://layer-extension/victoria-water-lines", "item://layer-extension/victoria-fire-hydrants" ] } }, "results.display", "charts.display", "kpi.display" ]
Comments
0 comments
Article is closed for comments.