The functionality I am seeking is to add a FeatureLayer (containing some data from a file selected for import) inside of a GroupLayer collecting all of the data from that particular source. The logic for creating the feature layer and adding it to the scene, and subsequently forcing it to refresh so that it draws, has been working for FeatureLayers some time. However, it doesn't work for GroupLayers. The refresh method is as such:

    public void RefreshLayerInDocument(ILayer layer)
                var sxdoc = this.Application.Document as ISxDocument;
                sxdoc.Scene.SceneGraph.Invalidate(layer, true, true);
                sxdoc.Scene.SceneGraph.Invalidate(sxdoc.Scene.SceneGraph.ActiveViewer, true, false);

Note that manually selecting Refresh on the TOC allows a proper refresh and everything works.

The code for creating the grouping and adding the feature layer to it takes the form;

            IGroupLayer newGroupLayer = new GroupLayer();
            newGroupLayer.Name = layerName;
            RefreshLayerInDocument(group as ILayer);

Altering the order of the Refresh calls on the group and the featurelayer has had no impact on the outcome, it still requires a manual refresh.

My thoughts are that there must be an invalidate call required for groups that I'm not aware of, but I haven't had any luck searching the documentation.

  • Did you try assigning a spatial ref to ILayer.SpatialReference on the grouplayer? Jan 3, 2012 at 15:14
  • Did you get this solved?
    – Andy
    Mar 12, 2014 at 15:25
  • I tried assigning a spatial ref to the group layer; and it seemed to have no effect.
    – Andy
    Mar 12, 2014 at 15:30
  • Never did find a solution for this, ended up going in a different direction.
    – DBaker
    Apr 7, 2014 at 23:50


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.