Select to view content in your preferred language

Annotation layer not showing

679
2
09-01-2022 02:53 PM
Paul_K
by
Emerging Contributor

Using ArcGISRuntime 100.15 and based on the ESRI Display Annotation Layer sample I have an app with the following code for displaying an annotation layer:

var map = new Map(BasemapStyle.ArcGISImagery){
    InitialViewpoint = new Viewpoint(-9167600, 3461570, Scale)};

var annoLayer = new AnnotationLayer(new Uri(UriText));
map.OperationalLayers.Add(annoLayer);
annoLayer.Loaded += (object sender, EventArgs e) => {
            var al = sender as AnnotationLayer;
            Trace.WriteLine($"{al.Name} loaded; visible: {al.IsVisible}; IsVisibleAtScale: {al.IsVisibleAtScale(Scale)}");
};

MyMapView.Map = map;

The 'Loaded' event fires and indicates that the annotation layer loaded without error, but it is not displaying on the map. When loaded, the SublayerContents property is empty, which seems suspicious since the annotation layer does have sublayers.

The annotation layer displays properly in ArcGIS Pro and in the online map viewer.

Any ideas on what might be wrong or what to look at next?

Tags (1)
0 Kudos
2 Replies
MichaelBranscomb
Esri Frequent Contributor

What does the MapView LayerViewStateChanged event report?

0 Kudos
Paul_K
by
Emerging Contributor

 

Thanks for that suggestion. I added event handling code as follows:

 

MyMapView.Map = new Map(BasemapStyle.ArcGISStreets);

MyMapView.LayerViewStateChanged += (sender, args) =>
{
    Trace.WriteLine($"Layer:'{args.Layer.Name}' Status:{args.LayerViewState.Status}");
    Trace.WriteIf(args.LayerViewState.Error is not null, $"\tError:{args.LayerViewState.Error}\n");
};

 

 

And, here's the output:

Layer:'World_Basemap_v2' Status:NotVisible
Layer:'' Status:Loading
Layer:'World_Basemap_v2' Status:Active
GasGenericAnno loaded; visible: True; IsVisibleAtScale: True
Layer:'GasGenericAnno' Status:NotVisible
Layer:'GasGenericAnno' Status:Active


0 Kudos