AnsweredAssumed Answered

Graphicslayer fullextent is null, confirmed Graphicslayers has graphics (polygons)

Question asked by lenzj on Oct 31, 2014
Latest reply on Nov 6, 2014 by akajanus-esristaff

Any help on this would be appreciated.

This does not work:

if (graphicsLayer.Graphics.Count > 0)

{

     Envelope gEnvelope = graphicsLayer.FullExtent;

     //(gEnvelope is null)

}

 

This Works:

if (graphicsLayer.Graphics.Count > 0)

{

          Envelope selEnv = null;

          foreach (Graphic g in graphicsLayer.Graphics)

          {

               if (selEnv == null)

               {

                    selEnv = g.Geometry.Extent;

               }

               else

               {

                    selEnv = selEnv.Union(g.Geometry.Extent);

               }

          }

          if (!selEnv.IsEmpty)

          {

               selEnv = selEnv.Expand(1.5);

               mapMain.SetView(selEnv);

          }

}

Outcomes