Editing Module
The Editing Module implements editing of features and related features in the viewer.
The Editing Module depends on the FeatureLayer Module, which implements feature layers in the HTML5 viewer. It also works with the Offline Module to support offline editing. In order for features to be editable, they must belong to a feature layer that has editing turned on.
The Editing Module has different views for the different parts of the viewer that provide access to feature editing: MapDataMenuView
, TemplatePickerView
, EditorView
, EditLogView
, CreateOrEditView
, and MultiFeatureSelectorView
.
The Editing Module has the following view models: TemplatePickerViewModel
, EditLogViewModel
, CreateOrEditViewModel
, EditorViewModel
, and EditingMapDataMenuViewModel
.
Create Point Features Using Geolocation
As of HTML5 Viewer 2.5, users can create point features by using geolocation. To enable this feature, edit your viewer in Essentials Manager, and in the Toolbar section, ensure both Create New Feature and CreateNewFeatureControlRegion
are included in your configured toolbar. You can configure geolocation settings with the Geolocate module. For information see Geolocate Module.
When the user selects a point feature template, a menu appears that offers geolocation. If the geolocation result is not within a configurable accuracy threshold, the user is prompted whether to use the result or select a different location on the map. The accuracy threshold is specified in the context-sensitive toolbar that is associated with the Geolocate module's FeaturePlacementPointGraphicState
by configuring a accuracyThreshold
property. You may also specify the number of milliseconds for which to refine the geolocation reading by configuring a timeLimit
property.
Alternatively, you can specify a geolocation profile by configuring a profile property in the Geolocate Module. The geolocation profiles are defined in the GeolocateViewModel
by the singleGeolocationProfiles
array. The CreateNewFeatureControlRegion
also includes snapping tools. In the case of the compact toolbar, do not include the region.
Feature Attachments
Users can add and delete file attachments from a feature at any time.
To add an attachment to a feature:
-
Click the feature to which you want to add an attachment.
A map tip for the feature appears.
-
Click the Edit Feature.
The View/Edit Attributes panel opens.
-
In the Manage Attachments section, click Add Attachments.
The File Upload window appears.
-
Select the file to upload and click Open.
The file to upload is added to the list of attachments.
The file will not be uploaded until you click Save in the next step.
-
Click Save.
The file is uploaded.
If you receive a Forbidden error message, check your proxy settings.
To delete an attachment from a feature:
-
Click the feature to which you want to add an attachment.
A map tip for the feature appears.
-
Click the Edit Feature.
The View/Edit Attributes panel opens.
-
In the Manage Attachments section, click beside the attachment you want to delete.
An alert appears informing you the file will not be deleted until you click Save.
-
Click OK.
The alert is dismissed and the file to delete is removed from the list of attachments.
-
Click Save.
The file is deleted.
Configuration Properties
Module
-
behaviors
: An array of named behaviors that run when an associated event occurs. By default, the behaviors are:-
EditorFeatureSelectedBehavior
: A behavior that runs an array of commands when a feature is selected while the user is editing features. By default, this includes four commands:ZoomToFeature
,SetActiveHighlightLayerDefault
,ClearHighlights
, andHighlightFeature
. -
EditorRemoveFeatureSelectedBehavior
: A behavior that runs an array of commands when a feature is deselected while the user is editing features, which mainly occurs when the user closes the Feature Attributes panel or edits the geometry of a feature. By default, this includes two commands:SetActiveHighlightLayerDefault
andClearHighlights
.
You can remove or rearrange the commands of any behavior. You can also remove behaviors altogether.
You can add commands to a behavior if the command does not require a parameter, or if the type of the command's parameter matches the parameter of an existing command or the event associated with the behavior. Refer to "Viewer Commands and Events" in Developer Help to determine if the parameters are compatible. Note that private commands and events are not documented.
Adding a new behavior is only recommended for experienced developers.
See Viewer Commands and Events for more information.
-
Views
-
MapDataMenuView
:-
menuId
: The ID of the menu that contains options for managing offline data. The default isMapDataMenu
. The menu is configured in the Menu Module.
-
-
TemplatePickerView
: Noconfiguration
properties -
EditorView
: Noconfiguration
properties -
EditLogView
: Noconfiguration
properties -
CreateOrEditView
: Noconfiguration
properties -
MultiFeatureSelectorView
: Noconfiguration
properties
View Models
-
TemplatePickerViewModel
: Noconfiguration
properties -
EditLogViewModel
: Noconfiguration
properties -
CreateOrEditViewModel
:-
searchRadiusMeters
: When a scanned QR code or barcode does not match a feature, the user can click the map to edit a feature to assign the scanned value. This property represents the meter radius around the point the user clicks to search for features to edit. For more information, see BarcodeScanner Module. -
tools
: When a scanned QR code or barcode does not match a feature, the user can click the map to edit a feature to assign the scanned value. This property represents the array of tools with which the user can select features to edit. The default includes a single tool,SelectFeaturesForEditingTool
. For more information, see BarcodeScanner Module.The Tools Module implements the ability to define an array of tools in other modules. Each tool in the array has the following properties:
-
name
: The name of the tool.If your viewer is going to be available in more than one language, enter the text key that the tool name is assigned to.
-
command
: The command that the tool runs.For a list of commands, see Viewer Commands and Events.
-
drawMode
: The type of geometry the user draws, upon which the tool operates. -
isSticky
: When set totrue
, the tool remains selected after the user has used it. To deselect the tool, the user must click the tool a second time, or click a different tool. This allows the user to use a tool repeatedly without having to reselect it each time.If you do not want a tool to remain selected after it is used, set
isSticky
tofalse
. -
iconUri
: The image that displays beside the tool. -
statusText
: The status message to display when the tool's input method is via mouse, often containing instructions for the user. You can use a text key or the literal text. -
keyboardStatusText
: The status message to display when the tool's input method is via keyboard, often containing keyboard shortcut hints for the user. You can use a text key or the literal text.
-
-
-
MultiFeatureSelectorViewModel
:-
displayResultPickerTemplateComplexity
: To display only feature labels in the feature selector, set tosimple
; to also display feature descriptions and icons, set tocomplex
. The default iscomplex
.
-
-
EditorViewModel
:-
editGeometry
: To allow the geometry of features to be edited, set totrue
. The default istrue
. -
validateGeometry
: To validate geometry changes when the user saves edited geometry, set totrue
. For example, a self-intersecting geometry is invalid. The default istrue
. -
tools
: An array of tools for the user to edit the geometry with. The factory configuration has tools to edit points, lines, polylines, freehand polylines, polygons, freehand polygons, circles, ellipses and rectangles.The Tools Module implements the ability to define an array of tools in other modules. Each tool in the array has the following properties:
-
name
: The name of the tool.If your viewer is going to be available in more than one language, enter the text key that the tool name is assigned to.
-
command
: The command that the tool runs.For a list of commands, see Viewer Commands and Events.
-
drawMode
: The type of geometry the user draws, upon which the tool operates. -
isSticky
: When set totrue
, the tool remains selected after the user has used it. To deselect the tool, the user must click the tool a second time, or click a different tool. This allows the user to use a tool repeatedly without having to reselect it each time.If you do not want a tool to remain selected after it is used, set
isSticky
tofalse
. -
iconUri
: The image that displays beside the tool. -
statusText
: The status message to display when the tool's input method is via mouse, often containing instructions for the user. You can use a text key or the literal text. -
keyboardStatusText
: The status message to display when the tool's input method is via keyboard, often containing keyboard shortcut hints for the user. You can use a text key or the literal text.
-
-
-
EditingMapDataMenuViewModel
: Noconfiguration
properties
Example - Add a Command with a Parameter to a Behavior
The following example demonstrates adding a new command with a parameter to the behavior, EditorFeatureSelectedBehavior
.
To add a command with a parameter to a behavior:
-
Run an XML editor or text editor as an administrator.
-
Open one of the viewer configuration files,
Desktop.json.js
,Tablet.json.js
, orHandheld.json.js
, in the editor.By default, the configuration files are here:
C:\Program Files (x86)\Latitude Geographics\Geocortex Essentials\[instance]\REST Elements\Sites\[site]\Viewers\[viewer]\VirtualDirectory\Resources\Config\Default\
-
In the
Editing
module section, find thebehaviors
property. Locate the behavior you want to edit, for example,EditorFeatureSelectedBehavior
.{ "moduleName": "Editing", ... "configuration": { "behaviors": [ { "name": "
EditorFeatureSelectedBehavior
", "commands": [ "ZoomToFeature
", "SetActiveHighlightLayerDefault", "ClearHighlights", "HighlightFeature" ] }, ... ] }, ... }The behavior executes a few commands, some that include a parameter, for example,
ZoomToFeature
. -
Refer to Viewer Commands and Events to determine the type of parameter that is associated with these commands.
ZoomToFeature
has a parameter of type,geocortex.essentialsHtmlViewer.mapping.infrastructure.Feature
. -
Find a command that you want to add to the behavior that has the same parameter type, for example,
ShowMapTip
. -
Add the desired command to the list of commands, separated by a comma. For example:
"commands": [ "ZoomToFeature", "SetActiveHighlightLayerDefault", "ClearHighlights", "HighlightFeature"
, "ShowMapTip"
] -
Save the file.