advanced-editing
This bundle adds tools to create, update and delete features.
Usage
No configuration is required! Default values are applied.
To use the features of this bundle, add one or more of the following tools to your app:
| Tool ID | Component | Description |
|---|---|---|
advancedEditingAddFeatureTool |
AdvancedEditingAddFeatureTool |
Create a new object. |
advancedEditingUpdateFeatureTool |
AdvancedEditingUpdateFeatureTool |
Update an existing object. |
advancedEditingMergeFeaturesTool |
AdvancedEditingMergeFeaturesTool |
Merge two existing objects. |
Configuration Reference
The following sample shows the configurable properties and its default values:
{
"advanced-editing": {
"Config": {
"showSketching": true,
"showSnappingControls": true,
"allowGeometryEditing": true,
"allowAttributeEditing": true,
"allowAttachmentEditing": true,
"allowMovingObject": true,
"allowBasemapSnapping": false,
"removeHelperGeometriesOnClose": true,
"snappingEnabled": true,
"selfSnappingEnabled": true,
"featureSnappingEnabled": true,
"gridSnappingEnabled": false,
"snappingDistance": 6,
"toggleGeometryEditModeOnClick": true,
"gridEnabledToggle": true,
"gridControls": true,
"featureTemplates": {
"groupBy": "layer",
"filterText": "",
"visibleElements": {
"filter": true
}
}
}
}
}
| Property | Type | Description |
|---|---|---|
showSketching |
Boolean | If set to false, the section for helper geometries is hidden. |
showSnappingControls |
Boolean | If this value is set to false, in the editing dialog the snapping controls widget is hidden. |
allowGeometryEditing |
Boolean | If set to false, the tab for geometry editing is hidden during the workflow of editing existing features. |
allowAttributeEditing |
Boolean | If set to false, the tab for attribute editing is hidden during the workflow of editing existing features. |
allowAttachmentEditing |
Boolean | If set to false, the tab for attachment editing is hidden during the workflow of editing existing features. |
allowMovingObject |
Boolean | If set to false, the object cannot be moved as a whole. |
allowBasemapSnapping |
Boolean | If set to true, basemaps are used for snapping as well. |
removeHelperGeometriesOnClose |
Boolean | If set to true, the helper geometries are removed when the editing dialog is closed. |
featureTemplates |
Object | Defines filter and group options for the template selector when adding new features. |
featureTemplates.groupBy |
String | Allowed values are layer, geometry and none. |
snappingEnabled |
Boolean | If set to true, all layers that allow snapping are snapped in the create and edit workflow. This state can also be controlled by the user in the user interface. This property deactivates snapping globally if it is set to false. It must be true so that the properties selfSnappingEnabled and featureSnappingEnabled have an effect. |
snappingDistance |
Number | Snapping distance for snapping in pixels. Default value is 6. |
selfSnappingEnabled |
Boolean | Global configuration option to turn self snapping (snapping on the feature that is currently being drawn or edited) on or off. snappingEnabled must be true for this option to have an effect. |
featureSnappingEnabled |
Boolean | Global configuration option to turn snapping on features (except the graphic that is currently edited) on or off. snappingEnabled must be true for this option to have an effect. |
gridSnappingEnabled |
Boolean | Global configuration option to turn snapping on grid on or off. Turns also turns the grid visibility in the map on or off. The grid is a network of columns and rows used to divide the view into equal-area squares. snappingEnabled must be true for this option to have an effect. |
toggleGeometryEditModeOnClick |
Boolean | Indicates if the graphic being edited can be toggled between transforming (scaling and rotating) and reshaping when clicked. This property has no effect, when allowMovingObject is set to false. In that case the toggle by click is already disabled. |
gridEnabledToggle |
Boolean | If set to true, the grid snapping can be enabled or disabled in the UI. Default is true. |
gridControls |
Boolean | If set to true, grid snapping options are shown in the UI. This is only useful when gridEnabledToggle is enabled. Contains UI elements to position, size and style a grid. |
Configuration for FeatureLayers
The following properties can be added directly to layer configurations:
{
"map": {
"layers": [
{
"id": "mylayer",
"type": "AGS_FEATURE",
"url": ".../FeatureServer/0",
"editingEnabled": true,
"advancedEditing": {
"allowSnapping": true,
"allowAdd": true,
"allowUpdate": true,
"allowDelete": true
}
}
]
}
}
| Property | Type | Description |
|---|---|---|
editingEnabled |
Boolean | If set to false, this layer is not provided for editing. |
advancedEditing |
Object | See below. |
Configurations options for advancedEditing:
| Property | Type | Description |
|---|---|---|
allowSnapping |
Boolean | If set to false, this layer is not used for snapping. This is independent from the global snapping settings in the UI. |
allowAdd |
Boolean | Determines whether the layer is displayed in the list of object templates when a new object is to be created. This property will only be considered if editingEnabled is set to true. |
allowUpdate |
Boolean | Determines whether buttons for editing features are displayed in the Edit widget, in the Result Center and in the popup. This property will only be considered if editingEnabled is set to true. |
allowDelete |
Boolean | Determines whether buttons for deleting features are displayed in the edit widget, in the Result Center and in the popup. This property will only be considered if editingEnabled is set to true. |
MergeViewModel
This component is the view model for the MergeWorkflowWidget. The following properties can be configured:
| Property | Type | Description |
|---|---|---|
attributeSkipList |
string[] |
A list of feature attribute names, that should not be displayed in the merge preview. |
External API
The external API allows developers to start the editing and get the resulting feature after the edit is complete.
Usage
Add the Editing reference to your component.
{
"name": "_editing",
"providing": "advanced-editing.Editing"
}
Create a new feature
Create a new feature for a specified FeatureLayer. Pass the layer ID of the according layer.
this._editing.createFeature("areas").then(
result => {
// handle result
},
reason => {
// error case
}
);
Edit an existing feature
Edit an existing feature that belongs to a FeatureLayer.
Pass the feature that must be an instance of esri/Graphic.
const featureLayer = this._mapWidgetModel.map.findLayerById("areas");
const queryParams = featureLayer.createQuery();
queryParams.where = "1=1";
featureLayer.queryFeatures(queryParams).then(results => {
const feature = results.features[0];
this._editing.editFeature(feature).then(
result => {
// handle result
},
reason => {
// error case
}
);
});
Create a new geometry
Pass the geometry type to create a new esri/geometry/Geometry.
this._editing.createGeometry("polygon").then(
result => {
// handle result
},
reason => {
// error case
}
);
Edit an existing geometry
Pass an existing instance of esri/geometry/Geometry to allow the user to edit it.
const geometry = new Polygon({
rings: [
[
[356517.0185643031, 5710524.887694486],
[356537.11723534466, 5710522.300539059],
[356541.35057714465, 5710473.352524496],
[356477.78500000015, 5710478.9120000005],
[356517.0185643031, 5710524.887694486]
]
],
spatialReference: {wkid: 25832}
});
this._editing.editGeometry(geometry).then(
result => {
// handle result
},
reason => {
// error case
}
);
EditorInterceptor
To get direct access to the initialization properties of the Editor widget (for example to customize additional
properties or watch for events), use this extension point.
You can register multiple advanced-editing.EditorInterceptor instances.
class MyEditorInterceptor {
intercept(editModel) {
// Add your code
}
}
In your manifest.json file, register the interceptor as advanced-editing.EditorInterceptor:
components: [
{
name: "MyEditorInterceptor",
provides: "advanced-editing.EditorInterceptor"
}
];