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.
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
The following code shows how to create a new graphics overlay and add it to your map view.
// create a graphics overlay
graphicsOverlay = new GraphicsOverlay();
// add graphics overlay to the map view
Now you're ready to add graphics and text to your graphics overlays.
Graphics overlays are visible only on a map view which contains a map, or a scene view which contains a scene. Graphics overlays do not have a time extent and do not participate in time-based filtering when a time extent is set on a map view or scene view.