Select to view content in your preferred language

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

3610
4
07-01-2016 08:53 AM
JeremyBridges
Frequent Contributor

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:

https://community.esri.com/ideas/10410

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?

0 Kudos
4 Replies
by Anonymous User
Not applicable

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.

0 Kudos
DuaneWhistle
Emerging 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"

0 Kudos
DuaneWhistle
Emerging Contributor

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

0 Kudos
by Anonymous User
Not applicable

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

0 Kudos