ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Core.CIM Namespace / CIMPointGraphic Class / Location Property
Example

In This Topic
    Location Property (CIMPointGraphic)
    In This Topic
    Gets or sets the location of the point graphic.
    Syntax
    public MapPoint Location {get; set;}
    Public Property Location As MapPoint
    Example
    Create Graphic Element using CIMGraphic
    {
      await QueuedTask.Run(() =>
      {
      //Place symbol on the layout
      MapPoint location = MapPointBuilderEx.CreateMapPoint(new Coordinate2D(9, 1));
    
      //specify a symbol
      var pt_symbol = SymbolFactory.Instance.ConstructPointSymbol(
                            ColorFactory.Instance.GreenRGB);
    
      //create a CIMGraphic
      var graphic = new CIMPointGraphic()
      {
        Symbol = pt_symbol.MakeSymbolReference(),
        Location = location //center of map
      };
      //Or use GraphicFactory
      var graphicFactory = GraphicFactory.Instance.CreateSimpleGraphic(location, pt_symbol);
    
      ElementFactory.Instance.CreateGraphicElement(layout, graphic);
      ElementFactory.Instance.CreateGraphicElement(layout, graphicFactory);
      });
    }
    Bulk Element creation
    {
      await QueuedTask.Run(() =>
      {
    
      //List of Point graphics
      var listGraphics = new List<CIMPointGraphic>();
      var listGraphicsFactory = new List<CIMPointGraphic>();
      //Symbol
      var pointSymbol = SymbolFactory.Instance.ConstructPointSymbol(
                                          ColorFactory.Instance.BlackRGB);
      //Define size of the array
      int dx = 5;
      int dy = 5;
      MapPoint point = null;
      //Create the List of graphics for the array
      for (int row = 0; row <= dx; ++row)
      {
        for (int col = 0; col <= dy; ++col)
        {
          point = MapPointBuilderEx.CreateMapPoint(col, row);
          //create a CIMGraphic
          var graphic = new CIMPointGraphic()
          {
            Symbol = pointSymbol.MakeSymbolReference(),
            Location = point
          };
          listGraphics.Add(graphic);
          //Or use GraphicFactory
          var graphicFactory = GraphicFactory.Instance.CreateSimpleGraphic(
                                        point, pointSymbol) as CIMPointGraphic;
          listGraphicsFactory.Add(graphicFactory);
        }
      }
      //Draw the array of graphics
    
      var bulkgraphics = ElementFactory.Instance.CreateGraphicElements(
                                                         layout, listGraphics);
      var bulkgraphicsFactory = ElementFactory.Instance.CreateGraphicElements(
                                                         layout, listGraphicsFactory);
      });
    }
    Create Element using a CIMGraphicElement
    {
      await QueuedTask.Run(() =>
      {
    
      //Place symbol on the layout
      MapPoint point = MapPointBuilderEx.CreateMapPoint(new Coordinate2D(9, 1));
    
      //specify a symbol
      var pt_symbol = SymbolFactory.Instance.ConstructPointSymbol(
                            ColorFactory.Instance.GreenRGB);
    
      //create a CIMGraphic
      var graphic = new CIMGraphicElement()
      {
        Graphic = new CIMPointGraphic()
        {
          Symbol = pt_symbol.MakeSymbolReference(),
          Location = point //A point in the layout
        }
      };
      ElementFactory.Instance.CreateElement(layout, graphic);
      });
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also