When will the ArcGIS Pro SDK allow access to the Graphics layer?

2790
4
07-01-2016 08:53 AM
Highlighted
New Contributor III

Having temporary elements on a map is a nice light-weight tool for users to add meaning to what they are looking at. Often, these need to be more sophisticated than simple Map Notes:

Is it on the roadmap to allow developers access to the Pro graphics layer? Or, to an isolated graphics layer that is filled with 3rd party elements?

Reply
0 Kudos
4 Replies
Highlighted
Esri Regular Contributor

Jeremy,

You can use the AddOverlay method to display a graphic on a 2D map by providing a geometry and a symbol.

This method is available from either the MapView or a MapTool.

The following example displays the vertices of a selected polyline as a graphic.

    protected override void OnClick()
    {
      //Run on MCT
      QueuedTask.Run(() =>
      {
        //get selected polyline
        var selectedFeatures = ArcGIS.Desktop.Mapping.MapView.Active.Map.GetSelection();
        var insp = new ArcGIS.Desktop.Editing.Attributes.Inspector();
        insp.Load(selectedFeatures.Keys.First(), selectedFeatures.Values.First());
        var polyLine = insp.Shape as ArcGIS.Core.Geometry.Polyline;

        //mp builder
        var multiPointBuilder = new ArcGIS.Core.Geometry.MultipointBuilder();
        multiPointBuilder.Add(polyLine.Points);

        //add overlay
        var markerSymbol = ArcGIS.Desktop.Mapping.SymbolFactory.ConstructMarker(ColorFactory.Red, 11.0, SimpleMarkerStyle.Diamond);
        var ptSymbol = SymbolFactory.ConstructPointSymbol(markerSymbol);
        var vertexGraphics = MapView.Active.AddOverlay(multiPointBuilder.ToGeometry(), ptSymbol.MakeSymbolReference());
        //vertexGraphics.Dispose(); //to clear the overlay
      });
    }

Note that this works differently from the ArcMap graphics container as the graphic is referenced by the returned IDisposable variable. This is usually managed within the lifetime of a tool.

Reply
0 Kudos
Highlighted
New Contributor

I have added  a marker symbol with this code but how to I programmatically label the symbol or create a popup with information on the map? for example, I want to label the point with "Latitude = 38.12345, Longitude = -97.65432"

Reply
0 Kudos
Highlighted
New Contributor

Here is a screen shot of how I want the symbol and label to look.

Reply
0 Kudos
Highlighted
Esri Regular Contributor

Its not currently possible to add text as graphics. There is no ETA on when that might be available.

Reply
0 Kudos