Add graphics overlays to your app

A graphics overlay is a container for temporary graphics that you want to display on your map view or scene view, such as the graphics in the following illustration. The graphics you draw in your graphics overlays are created at run time and are not persisted when your application closes.

Graphics overlays displayed on a map view

Typical use cases for adding graphic overlays to your map view or scene view include the following:

  • Showing the location of a moving object. The locations could be from your own GPS receiver
  • Showing the results of a geocoding or routing task
  • Drawing temporary map markups, sometimes referred to as red lining

A map view or scene view can contain many graphics overlays that are drawn on top of the layers in your map or scene. Each graphics overlay may contain a number of graphics. A graphic is defined by the following components:

  • Geometry, which is either a point, line, or polygon
  • Symbology, which defines how your geometry is drawn. For example, if the geometry is a line, then your symbology would define the line color as red
  • Attributes, which are an optional set of item fields in a database row

// Map view UI presentation at top
MapView {
    id: mapView
    anchors.fill: parent


    Map {
        BasemapOceans {}
        initialViewpoint: viewPoint
    }


    GraphicsOverlay {
        id: graphicsOverlay
    }
}

Now you're ready to add graphics and text to your graphics overlays.

Note:

Graphics overlays are visible only on a map view which contains a map, or a scene view which contains a scene.