On this page
The map feedback profile defines a dynamic set of features to show on the map. It is triggered by changes to dependent layers which are being watched or by other application changes.
Profile variables
Variable name | Type | Description |
---|---|---|
$map | FeatureSetCollection | The list of layers in the web map. Can be used with the FeatureSetByName or FeatureSetById function to get a particular layer in the map. This can then be queried. |
$userId | Text | The unique user ID of the editor who is logged into the application. |
$userName | Text | The full name of the editor who is logged into the application. |
$userIdentity | Text | Provides a credential instance. This can be used when accessing external layers with the FeatureLayer function. The credentials represent the user’s logged in credentials. |
$session | Dictionary | A dictionary containing key value pairs. The dictionary contains all the session variables that have been configured in the app. When the application first launches, the user will be asked for values for the session variables. They can also (if configured) change session variables in the application. This provides programmatic access to the user’s choices / settings. |
$selection | FeatureSetCollection | The list of layers in the web map. Can be used with the FeatureSetByName or FeatureSetById function to get a particular layer in the map. It will only contain the features from each layer selected on the map. This can then be queried. |
$currentMapExtent | Extent | The current map extent. This value is not available for all scripts. |
$currentTool | Text | The type of tool selected. Will be one of new , add , effects , reshape , subtract , pan , select , unprotect . This value is not available for all scripts. It also represents the current state, not the state for why the script is running. |
$drawingShape | Polygon | The current drawing shape being digitised on the map. Not available for all scripts. |
$drawingShapeLastPoint | Point | The last vertex added to the drawing Shape being digitised on the map. Not available for all scripts. |
$typeofEditOperation 1 | Text | The type of operation that just caused the feedback script to run. Will be one of new , add , newrelated , attributes , delete , effects , merge , split , reshape or subtract |
$unchangedMap 1 | FeatureSetCollection | The list of layers in the web map with data as it was originally before the current editing operation began executing. This is not available for all situations where scripting is run. |
$editedFeatures 1 | FeatureSet | The set of features that have just been edited. This works with the FeatureSetByName or FeatureSetById function, to get access to a per layer set of features. This will not contain deleted features, as they are no longer in the map. |
$originalEditedFeatures 1 | FeatureSet | The set of features that have just been edited (in their original form). This works with the FeatureSetByName or FeatureSetById function, to get access to a per layer set of features. This will contain deleted features. |
1: Will only be available if this is post edit map feedback.
Return types
null | FeatureSet
Value | Description |
---|---|
null | No features to show. |
FeatureSet | A set of features defined as a FeatureSet to show on the map. |
Example
Footer message based on selection:
/** Create a message indicating the number of selected features.
*/
// find the selected features in a map layer.
var mLayerSelection = FeatureSetByName($Selection, "Site Cover");
// Sum some fields together
var n = sum(
mLayerSelection,
"PriceBandAUnits + PriceBandBUnits + PriceBandCUnits"
);
return "Total value selected : " + n;
Display point when clicked on the map:
// This script works in combination with pointer move feedback, a session variable pointerLocation and custom keyboard shortcut
var mapGraphics = [];
Push(mapGraphics, {
geometry: $session.pointerLocation,
symbol: `{
"type": "esriSMS",
"style": "esriSMSCircle",
"color": [
255,
20,
147,
255
],
"size": 12,
"angle": 0,
"xoffset": 0,
"yoffset": 0,
"outline": {
"color": [
255,
255,
255,
255
],
"width": 1
}
}`
});
// Return symbol at the cursor point.
return {
graphics: mapGraphics
};
Pointer move feedback:
// This script works in combination with Feedback data script, a session variable pointerLocation and custom keyboard shortcut
// Purpose: On a keyboard shortcut, display a point at the pointer location. Store the pointer location in a session variable for further use
if ($event == "move") {
return null;
}
if ($pointerPoint == null) {
return {
"action": "noop"
};
}
// The actual map feedback data script can only listen and update if $session variable used.
// The $session variable cannot be updated from this script - the keyboard shortcut action will take the State variable and update the $session variable
State("pointerLocation", $pointerPoint);
return null;