Features and graphics
In this topic
In ArcGIS Runtime SDKs, features and graphics are typically representations of real-world objects on a map, such as polygons that represent parcels or points that represent address locations. They have a shape (geometry, in other words) and a collection of attributes to describe them. For display on a map, they can be rendered using a variety of symbols. Whether you use features, graphics, or both in your app depends on things like whether or not you need to save them for future use and whether you want to render items in a layer separately.
Graphic is a type of
Feature class provides an abstract base class for the instantiable classes
Attributes properties are defined on this base class, all features, including graphics, have geometry and attributes, and are therefore indistinguishable when displayed on the map. So, what's the difference between features and graphics?
In addition to the fact that
Graphic defines some extra properties, the biggest difference is that features are stored with a dataset and graphics are stored in memory. Features are displayed in a feature layer, which may use data from an online service or from a local cache. In either case, those features are physically stored on disk somewhere. Graphics, on the other hand, are always stored in memory on the client. They live in a graphics layer, and must be instantiated programmatically at runtime.
Although the term can also refer to a graphic, "feature" is most often used to refer to things like geodatabase or geopackage features, meaning features stored in a database. Graphics are usually called "graphics", although "graphic feature" would be more precise.
- Have geometry
- Have attributes stored in a table
- Are stored on disk
- Are displayed through a feature layer (of a single geometry type)
- Are symbolized according to the renderer defined for the feature service or the feature layer that contains them
- Can be selected via the feature layer
- Have geometry
- Have attributes stored in a collection of key/value pairs
- Are stored in memory
- Are displayed through a graphics layer (that can display graphics of diverse geometry types)
- Can be symbolized individually or according to the renderer applied to the graphics layer that contains them
- Can be selected (the selection state is managed by the graphic)
- Some display properties can be defined by the graphic, such as visibility and draw order
When to use features
Because features are stored in a database, they can be used to display a common set of data to all users of your app and between user sessions. On the other hand, graphics are created in the client app at runtime and therefore can only be used for a single user's session (unless you add logic to persist the graphics between sessions, such as serialization). Features can define a geometry type and an attribute schema that is consistent for the data you want to represent.
With these differences in mind, perhaps the most common use of features is to share data among several users.
You can publish features as part of a feature service. Layers in a feature service can be displayed in a map, symbolized in various ways, and queried using attribute, spatial, or temporal criteria. The rich editing tools available in the Runtime SDK also make it possible to expose editing functionality in your application, including the ability to control the types of edits made and who gets to make them.
The following example adds a new feature layer to the map based on an online data source. The symbology (renderer) used to display the layer is defined with the feature service.
// define the online data source (ServiceFeatureTable), get features in Web Mercator coordinates
var incidentsFeatureTable = await ServiceFeatureTable.OpenAsync
// create a new feature layer, pass the data source to the constructor
var incidentsLayer = new Esri.ArcGISRuntime.Layers.FeatureLayer(incidentsFeatureTable);
// add the feature layer to the map
When to use graphics
Graphics are created programmatically at runtime and do not need to be physically stored. This makes them ideal for displaying things specific to the current user's session with the application, or anything that only needs to be displayed temporarily.
Graphics are commonly used to perform things such as:
- Show the results of spatial analysis, such as buffer polygons around input features
- Highlight a selection in the map
- Add geometry drawn interactively by the user
- Provide animation for data that changes quickly (such as GPS positions or moving objects)
- Show text on the map
The following example creates a new graphics layer (if it doesn't already exist in the map) and adds a user-defined line as a graphic. The symbol for the graphic is created and applied explicitly.
var graphicsLayer = MyMap.Layers["MyGraphics"] as Esri.ArcGISRuntime.Layers.GraphicsLayer;
if (graphicsLayer == null)
graphicsLayer = new Esri.ArcGISRuntime.Layers.GraphicsLayer();
graphicsLayer.ID = "MyGraphics";
// define a line symbol (dashed blue)
var lineSymbol = new Esri.ArcGISRuntime.Symbology.SimpleLineSymbol();
lineSymbol.Color = Windows.UI.Colors.Blue;
lineSymbol.Style = Esri.ArcGISRuntime.Symbology.SimpleLineStyle.Dash;
lineSymbol.Width = 2;
// use the MapView's Editor to get polyline geometry from the user
var line = await MyMapView.Editor.RequestShapeAsync(Esri.ArcGISRuntime.Controls.DrawShape.Polyline,
// create a new graphic; set the Geometry and Symbol
var lineGraphic = new Esri.ArcGISRuntime.Layers.Graphic();
lineGraphic.Geometry = line;
lineGraphic.Symbol = lineSymbol;
// add the graphic to the graphics layer