ArcGISMapImageSublayer draws different (worse) after LoadAsync()

1348
7
Jump to solution
09-13-2018 08:30 AM
MikeQuetel1
Occasional Contributor

Why does calling LoadAsync() on an ArcGISMapImageSublayer make it draw differently and in this case draw worse/incorrectly?  Is this expected behavior?   I was calling load because I wanted access to some of the information in the MapServiceSubLayerInfo class for use in another part of my app. 

See before1.png and after1.png attached below.  The black blobs seen in after1.png shouldn't be there. Also, the layer stops drawing all together when zooming in.  See before2.png and after2.png attached below.

0 Kudos
1 Solution

Accepted Solutions
MichaelBranscomb
Esri Frequent Contributor

Hi,

To round out this thread - this issue was resolved in the v100.5 release of ArcGIS Runtime SDK for .NET.

Cheers

Mike

View solution in original post

0 Kudos
7 Replies
JenniferNery
Esri Regular Contributor

LoadAsync on ArcGISMapImageSublayer should not have any effect on how ArcGISMapImageLayer is rendered, it only retrieves metadata. Are you by any chance rendering the sublayer as FeatureLayer?

Can you share some repro code? Thanks.

You can subscribe to GeoView.LayerViewStateChanged to find the current status of the layer when it becomes invisible, see if LayerViewStatus is OutOfScale, NotVisible or if there's an error associated with it.

0 Kudos
MikeQuetel1
Occasional Contributor

The layer(s) in question were not added to the map individually as feature layers.  I'm just traversing the sublayers of the dynamic map service can calling LoadAsync to get metadata such as capabilities.  I've edited my original post to include a .zip containing repro code.  Please check out the readme.txt in the .zip for more info.  Thanks.

0 Kudos
JenniferNery
Esri Regular Contributor

Thank you for sharing your repro sample. I have logged an issue. I think it's a valid bug that loading sub layers changed the symbology.

To workaround this issue, after you've loaded the sub layer to retrieve metadata, you can reset sub layers such that it does not pass along dynamicLayer parameter in the image request. This should have only happened if you re-arranged sublayers or given a different source.

((ArcGISMapImageLayer)e.Layer).ResetSublayers();
0 Kudos
MikeQuetel1
Occasional Contributor

Thanks for your feedback, looking for more info about ResetSublayers().

My scenario is that I have a dynamic map service with per request modification of layer order and symbology enabled and all sublayers are toggled to be not visible.   Then, I have a web map which loads this service, but the web map specifies that some sublayers are visible, others not visible and others have been removed completely from the webmap.  The runtime app has loaded this webmap then calls ResetSublayers().  What should I expect to happen with respect to drawing behavior.  The API documentation doesn't really give me a clue of what would happen in this non-trivial but real-world scenario.

0 Kudos
JenniferNery
Esri Regular Contributor

I see, thanks for clarification.

ResetSublayers will use service-defined visibility so it's not an option for this webmap then.

What metadata do you need from the sublayers? Would it work for you to load its metadata onto dummy table no data/features? What we need to avoid until this bug is fixed is loading of sublayer because it adds more to the dynamicLayer request than necessary.

MyMapView.LayerViewStateChanged += async (s, e) =>
  {
      if (e.Layer is ArcGISMapImageLayer && e.LayerViewState.Status == LayerViewStatus.Active)
      {
          var sublayer = ((ArcGISMapImageLayer)e.Layer).SublayerContents.FirstOrDefault(l => l.Name == "Pavement Markings") as ArcGISMapImageSublayer;
          foreach (ArcGISMapImageSublayer sub in sublayer.Sublayers)
          {
              var table = new ServiceFeatureTable(new Uri($"{((ArcGISMapImageLayer)e.Layer).Source.OriginalString}/{sub.Id}"));
              await table.LoadAsync();
              var metadata = table.LayerInfo; // can you use this instead?
          }
      }
  };
MyMapView.Map = new Map(new Uri("http://pdx.maps.arcgis.com/home/webmap/viewer.html?webmap=f118c376c6ea49d7839dacc50a7d138f")); 
0 Kudos
MikeQuetel1
Occasional Contributor

I think this will work, I'll need to refactor a bit before I can be sure.  Thanks for the additional idea.  What I was going after by loading the sublayer is the MapServiceCapabilities, specifically SupportsQuery.  This lets me inform the app user which layers are selectable in the context of a graphical query.

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

Hi,

To round out this thread - this issue was resolved in the v100.5 release of ArcGIS Runtime SDK for .NET.

Cheers

Mike

0 Kudos