Use the Geometry Editor to create new point, multipoint, polyline, or polygon geometries or to edit existing geometries by interacting with a map view.
A field worker can mark features of interest on a map using an appropriate geometry. Features such as sample or observation locations, fences or pipelines, and building footprints can be digitized using point, multipoint, polyline, and polygon geometry types. Polyline and polygon geometries can be created and edited using a vertex-based creation and editing tool (i.e. vertex locations specified explicitly via tapping), or using a freehand tool.
To create a new geometry, press the button appropriate for the geometry type you want to create (i.e. points, multipoints, polyline, or polygon) and interactively tap and drag on the map view to create the geometry. To edit an existing geometry, tap the geometry to be edited in the map and then perform edits by tapping and dragging its elements. When using an appropriate tool to select a whole geometry, you can use the control handles to scale and rotate the geometry. If creating or editing polyline or polygon geometries, choose the desired creation/editing tool (i.e. VertexTool
, ReticleVertexTool
, FreehandTool
, or one of the available ShapeTool
s).
When using the ReticleVertexTool
, you can move the map position of the reticle by dragging and zooming the map. Insert a vertex under the reticle by tapping on the map. Move a vertex by tapping when the reticle is located over a vertex, drag the map to move the position of the reticle, then tap a second time to place the vertex.
Use the control panel to undo or redo changes made to the geometry, delete a selected element, save the geometry, stop the editing session and discard any edits, and remove all geometries from the map.
- Create a
GeometryEditor
and set it to the MapView usingMyMapView.GeometryEditor
. - Start the
GeometryEditor
usingGeometryEditor.Start(GeometryType)
to create a new geometry orGeometryEditor.Start(Geometry)
to edit an existing geometry.- If using the Geometry Editor to edit an existing geometry, the geometry must be retrieved from the graphics overlay being used to visualize the geometry prior to calling the start method. To do this:
- Use
MapView.IdentifyGraphicsOverlayAsync(...)
to identify graphics at the location of a tap. - Access the
MapView.IdentifyGraphicsOverlayAsync(...)
. - Find the desired graphic in the
results.FirstOrDefault()
list. - Access the geometry associated with the
Graphic
usingGraphic.Geometry
- this will be used in theGeometryEditor.Start(Geometry)
method.
- Use
- If using the Geometry Editor to edit an existing geometry, the geometry must be retrieved from the graphics overlay being used to visualize the geometry prior to calling the start method. To do this:
- Create
VertexTool
,ReticleVertexTool
,FreehandTool
, orShapeTool
objects to define how the user interacts with the view to create or edit geometries, settingGeometryEditor.Tool
. - Edit a tool's InteractionConfiguration to set the GeometryEditorScaleMode to allow either uniform or stretch scale mode.
- Check to see if undo and redo are possible during an editing session using
GeometryEditor.CanUndo
andGeometryEditor.CanRedo
. If it's possible, useGeometryEditor.Undo()
andGeometryEditor.Redo()
. - Check whether the currently selected
GeometryEditorElement
can be deleted (GeometryEditor.SelectedElement.CanDelete
). If the element can be deleted, delete usingGeometryEditor.DeleteSelectedElement()
. - Call
GeometryEditor.Stop()
to finish the editing session and store theGraphic
. TheGeometryEditor
does not automatically handle the visualization of a geometry output from an editing session. This must be done manually by propagating the geometry returned into aGraphic
added to aGraphicsOverlay
.- To create a new
Graphic
in theGraphicsOverlay
:- Using
Graphic(Geometry)
, create a new Graphic with the geometry returned by theGeometryEditor.Stop()
method. - Append the
Graphic
to theGraphicsOverlay
(i.e.GraphicsOverlay.Graphics.Add(Graphic)
).
- Using
- To update the geometry underlying an existing
Graphic
in theGraphicsOverlay
:- Replace the existing
Graphic
'sGeometry
property with the geometry returned by theGeometryEditor.Stop()
method.
- Replace the existing
- To create a new
- Geometry
- GeometryEditor
- Graphic
- GraphicsOverlay
- MapView
The sample opens with the ArcGIS Imagery basemap centered on the island of Inis Meain (Aran Islands) in Ireland. Inis Meain comprises a landscape of interlinked stone walls, roads, buildings, archaeological sites, and geological features, producing complex geometrical relationships.
draw, edit, freehand, geometry editor, sketch, vertex