Click or drag to resize

GraphicsOverlay Class

A collection of vector graphics for overlaying on the map
Inheritance Hierarchy

Namespace:  Esri.ArcGISRuntime.UI
Assembly:  Esri.ArcGISRuntime (in Esri.ArcGISRuntime.dll) Version:
public sealed class GraphicsOverlay : INotifyPropertyChanged, 

The GraphicsOverlay type exposes the following members.

Public methodCode exampleGraphicsOverlay
Initializes a new instance of the GraphicsOverlay class.
Public propertyCode exampleExtent
Gets the extent of the GraphicsOverlay.
Public propertyCode exampleGraphics
Gets the graphics collection.
Public propertyCode exampleId
Gets or sets an ID for the overlay
Public propertyIsPopupEnabled
Gets or sets a value indicating whether the PopupDefinition defined is enabled.
Public propertyIsVisible
Gets or sets the overlay visibility.
Public propertyLabelDefinitions
Gets a modifiable collection of label definitions for this graphics overlay.
Public propertyLabelsEnabled
Gets or sets a value indicating whether labels should be displayed for Graphics in this overlay.
Public propertyMaxScale
Gets or sets the maximum scale to display this layer at. A small number allows the map to display the layer when zooming further in.
Public propertyCode exampleMinScale
Gets or sets the minimum scale to render this layer at. A large number allows the map to display the layer when zooming further out.
Public propertyOpacity
Gets or sets the opacity. Must be a value between 0 and 1.
Public propertyPopupDefinition
Gets or sets the pop-up definition for the graphics overlay.
Public propertyCode exampleRenderer
Gets or sets the renderer used for generating symbols.
Public propertyRenderingMode
Gets or sets a value indicating which rendering mode to use
Public propertyCode exampleSceneProperties
Gets or sets the scene properties for the graphics overlay.
Public propertySelectedGraphics
Gets the selected graphics.
Public propertySelectionColor Obsolete.
Gets or sets the color for selected graphics.
Public methodCode exampleClearSelection
Unselects all graphics in the layer
Protected methodFinalize
Finalizes an instance of the GraphicsOverlay class.
(Overrides ObjectFinalize.)
Public methodFromQueryResultJsonAsync Obsolete.
Deserializes the graphics from a JSON string containing the result of a query.
Public methodSelectGraphics
Selects the specified graphics.
Public methodUnselectGraphics
Unselects the specified graphics.
Public eventPropertyChanged
Occurs when a property value changes.


Example Name: Project

Project a point to another spatial reference.

Code example screen shot.

// Copyright 2019 Esri.
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
// language governing permissions and limitations under the License.

using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Symbology;
using Esri.ArcGISRuntime.UI;
using Esri.ArcGISRuntime.UI.Controls;
using Color = System.Drawing.Color;

namespace ArcGISRuntime.WPF.Samples.Project
        "Project a point to another spatial reference.",
    public partial class Project
        public Project()

        private async void Initialize()
            // Show a map in the default WebMercator spatial reference.
            MyMapView.Map = new Map(Basemap.CreateNationalGeographic());

            // Add a graphics overlay for showing the tapped point.
            GraphicsOverlay overlay = new GraphicsOverlay();
            SimpleMarkerSymbol markerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Circle, Color.Red, 5);
            overlay.Renderer = new SimpleRenderer(markerSymbol);

            // Respond to user taps.
            MyMapView.GeoViewTapped += MapView_Tapped;

            // Zoom to Minneapolis.
            Envelope startingEnvelope = new Envelope(-10995912.335747, 5267868.874421, -9880363.974046, 5960699.183877,
            await MyMapView.SetViewpointGeometryAsync(startingEnvelope);

        private void MapView_Tapped(object sender, GeoViewInputEventArgs e)
            // Get the tapped point - this is in the map's spatial reference,
            // which in this case is WebMercator because that is the SR used by the included basemaps.
            MapPoint tappedPoint = e.Location;

            // Update the graphics.
            MyMapView.GraphicsOverlays[0].Graphics.Add(new Graphic(tappedPoint));

            // Project the point to WGS84
            MapPoint projectedPoint = (MapPoint) GeometryEngine.Project(tappedPoint, SpatialReferences.Wgs84);

            // Format the results in strings.
            string originalCoords = string.Format("Original: {0:F4}, {1:F4}", tappedPoint.X, tappedPoint.Y);
            string projectedCoords = string.Format("Projected: {0:F4}, {1:F4}", projectedPoint.X, projectedPoint.Y);
            string formattedString = string.Format("{0}\n{1}", originalCoords, projectedCoords);

            // Define a callout and show it in the map view.
            CalloutDefinition calloutDef = new CalloutDefinition("Coordinates:", formattedString);
            MyMapView.ShowCalloutAt(tappedPoint, calloutDef);
<UserControl x:Class="ArcGISRuntime.WPF.Samples.Project.Project"
        <esri:MapView x:Name="MyMapView" />
See Also
Additional Examples
Hyperlink to ExampleDescription
AddGraphicsRendererThis sample demonstrates how you add graphics and set a renderer on a graphic overlays.
AddGraphicsWithSymbolsThis sample demonstrates how to add various types of graphics to a `GraphicsOverlay`.
AnalyzeViewshedThis sample demonstrates how to use GeoprocessingTask to calculate a viewshed using a geoprocessing service. Click any point on the map to see all areas that are visible within a 1 kilometer radius. It may take a few seconds for the model to run and send back the results.
Animate3DGraphicThis sample demonstrates how to animate a graphic's position and follow it using a camera controller.
BufferThis sample demonstrates how to use `GeometryEngine.Buffer` to create polygons from a map location and linear distance (radius). For each input location, the sample creates two buffer polygons (using the same distance) and displays them on the map using different symbols. One polygon is calculated using the `planar` (flat) coordinate space of the map's spatial reference. The other is created using a `geodesic` technique that considers the curved shape of the Earth's surface (which is generally a more accurate representation). Distortion in the map increases as you move away from the standard parallels of the spatial reference's projection. This map is in Web Mercator so areas near the equator are the most accurate. As you move the buffer location north or south from that line, you'll see a greater difference in the polygon size and shape. Planar operations are generally faster, but performance improvement may only be noticeable for large operations (buffering a great number or complex geometry). Creating buffers is a core concept in GIS proximity analysis, allowing you to visualize and locate geographic features contained within a polygon. For example, suppose you wanted to visualize areas of your city where alcohol sales are prohibited because they are within 500 meters of a school. The first step in this proximity analysis would be to generate 500 meter buffer polygons around all schools in the city. Any such businesses you find inside one of the resulting polygons are violating the law. If you are using planar buffers, make sure that the input locations and distance are suited to the spatial reference you're using. Remember that you can also create your buffers using geodesic and then project them to the spatial reference you need for display or analysis. For more information about using buffer analysis, see [How buffer analysis works]( in the ArcGIS Pro documentation.
BufferListThis sample demonstrates how to use a planar (Euclidean) buffer operation by calling `GeometryEngine.Buffer` to generate one or more polygons from a collection of input geometries and a corresponding collection of buffer distances. The result polygons can be returned as individual geometries or unioned into a single polygon output.
ClipGeometryThis sample demonstrates how to clip a geometry with an envelope using the GeometryEngine
ClosestFacilityDemonstrates how to solve a Closest Facility Task to find the closest route between a facility (hospital) and a incident (black cross).
ClosestFacilityStaticDemonstrates how to solve a Closest Facility Task to find the closest route between facilities and incidents.
ConvexHullThis sample demonstrates how to use the GeometryEngine.ConvexHull operation to generate a polygon that encloses a series of user-tapped map points.
ConvexHullListThis sample demonstrates how to use the GeometryEngine.ConvexHull to generate convex hull polygon(s) from multiple input geometries.
CreateGeometriesThis sample demonstrates simple ways to create different types of Geometry. The geometries are added as Graphics to a GraphicsOverlay and displayed in a MapView. An Envelope is used to set the Viewpoint of the MapView.
CutGeometryThis sample demonstrates how to cut a geometry with a polyline using the GeometryEngine.
DensifyAndGeneralizeThis sample demonstrates how to densify or generalize a polyline geometry. In this example, points representing a ship's location are shown at irregular intervals. You can densify the polyline to interpolate points along the line at regular intervals. Generalizing the polyline can also simplify the geometry while preserving its general shape.
DictionaryRendererGraphicsOverlayRender graphics with mil2525d symbols.
EditAndSyncFeaturesThis sample demonstrates how to synchronize offline edits with a feature service.
ExportTilesThis sample demonstrates how to export tiles from a map server.
FindAddressThis sample demonstrates how you can use the LocatorTask API to geocode an address and display it with a pin on the map. Tapping the pin displays the reverse-geocoded address in a callout.
FindPlaceThis sample demonstrates how to use geocode functionality to search for points of interest, around a location or within an extent.
FindRouteThis sample demonstrates how to solve for the best route between two locations on the map and display driving directions between them.
FindServiceAreaDemonstrates how to find services areas around a point using the ServiceAreaTask. A service area shows locations that can be reached from a facility based off a certain impedance [travel time in this case]. Service areas for a two and five minute travel time are used. Barriers can also be added which can effect the service area by not letting traffic through and adding to the time to get to locations.
FormatCoordinatesThis sample demonstrates how to convert between `MapPoint` and string representations of a point using various coordinate systems.
GenerateGeodatabaseThis sample demonstrates how to take a feature service offline by generating a geodatabase.
GenerateOfflineMapThis sample demonstrates how to generate an offline map for a web map in ArcGIS Portal.
GeodesicOperationsThis sample demonstrates how to use the Geometry engine to calculate a geodesic path between two points and measure its distance.
IdentifyGraphicsThis sample demonstrates how to identify graphics in a graphics overlay. When you tap on a graphic on the map, you will see an alert message displayed.
LineOfSightGeoElementThis sample demonstrates how to perform a dynamic line of sight analysis between two moving GeoElements.
ListTransformationsThis sample demonstrates how to use the TransformationCatalog to get a list of available DatumTransformations that can be used to project a Geometry between two different SpatialReferences, and how to use one of the transformations to perform the GeometryEngine.project operation. The TransformationCatalog is also used to set the location of files upon which grid-based transformations depend, and to find the default transformation used for the two SpatialReferences.
MapImageLayerTablesThis sample demonstrates how to get a non-spatial table from an ArcGIS map image layer. It shows how to query such a table, as well as how to find related features in another table. The non-spatial tables contained by a map service may contain additional information about sublayer features. Such information can be accessed by traversing table relationships defined in the service.
MapImageSublayerQueryThis sample demonstrates how to execute an attribute and spatial query on the sublayers of an ArcGIS map image layer. Sublayers of an ArcGISMapImageLayer may expose a ServiceFeatureTable through a Table property.This allows you to perform the same queries available when working with a table from a FeatureLayer: attribute query, spatial query, statistics query, query for related features, and so on.
MobileMapSearchAndRouteDisplay maps and use locators to enable search and routing offline using a Mobile Map Package.
NearestVertexThis sample demonstrates how to use the Geometry engine find the nearest vertex and nearest coordinate of a polygon to a point. The distance for each is shown.
OfflineBasemapByReferenceUse the OfflineMapTask to take a web map offline while using a basemap previously taken offline.
OfflineGeocodeGeocode with offline data.
ProjectProject a point to another spatial reference.
RenderPictureMarkersThis sample demonstrates how to create picture marker symbols from a URL and embedded resources.
RenderSimpleMarkersThis sample adds a point graphic to a graphics overlay symbolized with a red circle specified via a SimpleMarkerSymbol.
ReverseGeocodeUse an online geocoding service to find the address for a point.
ScenePropertiesExpressionsUpdate the orientation of a graphic using scene property rotation expressions.
SceneSymbolsShow various kinds of 3D symbols in a scene.
SimpleRenderersThis sample demonstrates how to create a simple renderer and add it to a graphics overlay. Renderers define the symbology for all graphics in a graphics overlay (unless they are overridden by setting the symbol directly on the graphic). Simple renderers can also be defined on feature layers using the same code.
SketchOnMapThis sample demonstrates how to interactively sketch and edit graphics in the map view and display them in a graphics overlay. You can sketch a variety of geometry types and undo or redo operations.
SpatialOperationsDemonstrates how to use the GeometryEngine to perform geometry operations between overlapping polygons in a GraphicsOverlay.
SpatialRelationshipsThis sample demonstrates how to use the GeometryEngine to evaluate the spatial relationships (for example, polygon a contains line b) between geometries.
SurfacePlacementsThis sample demonstrates how to position graphics using different Surface Placements.
UseDistanceCompositeSymThis sample demonstrates how to create a `DistanceCompositeSceneSymbol` with unique marker symbols to display at various distances from the camera.
ViewshedGeoElementDisplay a live viewshed analysis for a moving GeoElement.
ViewshedLocationThis sample demonstrates the configurable properties of viewshed analysis, including frustum color, heading, pitch, distances, angles, and location.