Configuration

Add editing functions to an app

The delivery includes a sample app that shows how to use the editing features.

To add editing capabilities to an app, add the advanced-editing bundle to your app and add the tools or actions described below to a tool set, popup, or Result Center.

Tools

Add the desired tools to the app:

Feature Tool ID

Create new object

advancedEditingAddFeatureTool

Edit object

advancedEditingUpdateFeatureTool

Objekte zusammenführen

advancedEditingMergeFeaturesTool

General hints on configuring tools are described in the Tools section of the map.apps documentation.

Edit action in popups

To allow users to start editing an existing object from a popup, add the custom action advanced-editing-edit-object in the configuration of the respective map layer as in the following sample:

{
    "map-init": {
        "Config": {
            "basemaps": [],
            "map": {
                "layers": [
                    {
                        "id": "status",
                        "url": "https://www.example.com/arcgis/rest/services/mapapps/stoerung/FeatureServer/1",
                        "type": "AGS_FEATURE",
                        "popupTemplate": {
                            "customActions": [
                                "advanced-editing-edit-object"
                            ]
                        }
                    }
                ]
            }
        }
    }
}

Editing actions in the Result Center

Features from editable layers can be edited from the Result Center as soon as the result-ui and advanced-editing bundles are used in an app. The Result Center is minimized as soon as editing is started via a row action.

result ui action

Map layers

Add the layers to be used for editing to the app. Details about this are described in section Map Content of the map.apps documentation.

To specify whether a layer may be used for editing and/or snapping, use the following configuration. The default values are true.

{
    "id": "mylayer",
    "type": "AGS_FEATURE",
    "url": ".../FeatureServer/0",
    "advancedEditing": {
        "allowSnapping": true,
        "allowEditing": true
    }
}

Editing interfaces

The following parameters are available for configuration:

Name Description

allowGeometryEditing

Determines whether the Geometry tab is displayed.

allowAttributeEditing

Determines whether the Attributes tab is displayed.

allowAttachmentEditing

Determines whether the Attachments tab is displayed.

The following example shows the configuration with the default values:

{
    "advanced-editing": {
        "Config": {
            "allowGeometryEditing": true,
            "allowAttributeEditing": true,
            "allowAttachmentEditing": true
        }
    }
}

Customize geometry editing dialog

The following parameters are available for configuration:

Name Description

showSketching

Determines whether the tools for drawing temporary helper geometries are displayed.

The following example shows the configuration with the default values:

{
    "advanced-editing": {
        "Config": {
            "showSketching": true
        }
    }
}

Customize attribute editing dialog

To customize the input forms for attribute editing, so called FormTemplates can be used, which are defined at the respective feature layer. This allows a selection of displayed attributes, their order and grouping to be specified.

The following example shows the definition of a FormTemplate:

{
    "map-init": {
        "Config": {
            "basemaps": [],
            "map": {
                "layers": [
                    {
                        "id": "status",
                        "url": "https://www.example.com/arcgis/rest/services/mapapps/stoerung/FeatureServer/1",
                        "type": "AGS_FEATURE",
                        "title": "Layer with custom formTemplate",
                        "formTemplate": {
                            "title": "Bürger melden Störungen",
                            "description": "Helfen Sie dabei, unsere Stadt schön zu halten!",
                            "elements": [
                                {
                                    "type": "group",
                                    "label": "Art der Störung",
                                    "description": "Im ersten Schritt, geben Sie bitte die Art der Störung ein.",
                                    "elements": [
                                        {
                                            "type": "field",
                                            "fieldName": "art",
                                            "label": "Was möchten Sie melden?"
                                        }
                                    ]
                                },
                                {
                                    "type": "group",
                                    "label": "Details zur Erfassung",
                                    "description": "Geben Sie in diesem Schritt optional weitere Informationen ein.",
                                    "elements": [
                                        {
                                            "type": "field",
                                            "fieldName": "details",
                                            "label": "Details zur Meldung"
                                        },
                                        {
                                            "type": "field",
                                            "fieldName": "zeitpunkt",
                                            "label": "Zeitpunkt der Meldung"
                                        }
                                    ]
                                }
                            ]
                        }
                    }
                ]
            }
        }
    }
}

Behavior while editing

Prevent objects from being moved

To disable the ability to move objects as a whole, set the following configuration:

{
    "advanced-editing": {
        "Config": {
            "allowMovingObject": true
        }
    }
}

It is still possible to move individual vertices.

Snapping

Allow snapping on base maps

To enable snapping on base maps, set the following configuration:

{
    "advanced-editing": {
        "Config": {
            "allowBasemapSnapping": true
        }
    }
}

Snapping tolerance

To change the snapping tolerance, set the following configuration (6 pixels is the default value):

{
    "advanced-editing": {
        "Config": {
            "snappingOptions": {
                "distance": 6
            }
        }
    }
}

Disable right angles and parallel lines snapping

To prevent right angles and parallel lines to previously drawn segments from being displayed and snapped when drawing lines or areas, set the following configuration:

{
    "advanced-editing": {
        "Config": {
            "snappingOptions": {
                "selfEnabled": false
            }
        }
    }
}
For more information about configuration, see the bundle documentation .