Point, polyline, and polygon geometries displayed using graphics and a graphics layer
What is a graphic?
A graphic is a visual element displayed on a map or scene. A graphic is used to temporarily display features as points, lines, and polygons on a map or scene. For example, you can use a graphic to display a marker with your current GPS location.
You can use graphics to:
Display points, lines, polygons, and text in a map or scene.
Display geometry with different symbols in 2D and 3D.
Move elements on the display.
Display attributes in a pop-up when an element is clicked.
How a graphic works
Graphics are used to display a point, line, polygon, or text on a map or scene. They are temporary and are created at runtime by an application. For example, you can use data from a GPS to display a graphic on a map that represents the location of a device. The graphic (and data) do not persist when the application closes.
Graphics can be added to a graphics layer, graphic overlay, or view. To ensure they are always visible, they are typically added on top of all other layers. When a map view displays a map, graphics are the last to be displayed.
Figure 1: Graphics displayed on top of a basemap layer and data layers.
Graphic composition
A graphic is composed of a geometry, symbol, and attributes.
ArcGIS API for JavaScriptArcGIS Runtime API for .NETArcGIS Runtime API for AndroidArcGIS Runtime API for iOSArcGIS Runtime API for JavaArcGIS Runtime API for Qt (C++)ArcGIS Runtime API for Qt (QML)
A graphic contains a geometry which defines its position on earth. A geometry is a geometric shape such as a point, polyline, or polygon.
ArcGIS API for JavaScriptArcGIS Runtime API for .NETArcGIS Runtime API for AndroidArcGIS Runtime API for iOSArcGIS Runtime API for JavaArcGIS Runtime API for Qt (C++)ArcGIS Runtime API for Qt (QML)
A graphic contains a symbol that defines how it is displayed. A symbol contains styling information. Simple symbols have one layer and are displayed as vectors. More complex symbols can be composed of multiple layers. Marker symbols can display an image at the location of a point geometry.
To display a graphic in 2D or 3D, in most cases you can use a 2D symbol.
ArcGIS API for JavaScriptArcGIS Runtime API for .NETArcGIS Runtime API for AndroidArcGIS Runtime API for iOSArcGIS Runtime API for JavaArcGIS Runtime API for Qt (C++)ArcGIS Runtime API for Qt (QML)
To display a graphic with a 3D shape, use a 3D symbol.
ArcGIS API for JavaScriptArcGIS Runtime API for .NETArcGIS Runtime API for AndroidArcGIS Runtime API for iOSArcGIS Runtime API for JavaArcGIS Runtime API for Qt (C++)ArcGIS Runtime API for Qt (QML)
Graphics can also contain attributes. Attributes are field and data values that describe the graphic. For example, a graphic can contain name, ID, and type attributes. Attributes are useful for displaying information when a user clicks on a graphic.
ArcGIS API for JavaScriptArcGIS Runtime API for .NETArcGIS Runtime API for AndroidArcGIS Runtime API for iOSArcGIS Runtime API for JavaArcGIS Runtime API for Qt (C++)ArcGIS Runtime API for Qt (QML)
This example displays a point, line, and polygon in a map. It adds graphics to a graphics layer or an overlay. It also adds a simple pop-up when the graphic is clicked.
Steps
Create a geometry to define the coordinates and shape.
Create a symbol to define the style.
Define attributes to show data when they are clicked.
Add the graphic to a graphics layer, graphics overlay, or view.
Map
ArcGIS API for JavaScript ArcGIS Runtime API for .NETArcGIS Runtime API for AndroidArcGIS Runtime API for .iOSArcGIS Runtime API for JavaArcGIS Runtime API for Qt (C++)ArcGIS Runtime API for Qt (QML)
This example displays a point, line, and polygon in a scene. It adds graphics to a graphic layer or an overlay.
Steps
Create a geometry to define the coordinates and shape.
Create a symbol to define the style.
Define attributes to show data when they are clicked.
Add the graphic to a graphic layer, graphic overlay, or view.
Scene
ArcGIS API for JavaScript ArcGIS Runtime API for .NETArcGIS Runtime API for AndroidArcGIS Runtime API for .iOSArcGIS Runtime API for JavaArcGIS Runtime API for Qt (C++)ArcGIS Runtime API for Qt (QML)