I have a piece of code to display Name of all layers of a WebMap.
I am using the AllLayers property to enumerate the layers.
I am surprised to get an empty Name for the first layer in the collection that correspond to the BaseMap layer whereas the BaseMap property has the correct Name.
The base map is OpenStreetMap. The problem seems not to happen with the Topographic base map.
Can someone tell me if there is any reason ? Or is it a known issue ?
I am able to see the same issue as you see. But if I used "Attribution" property of the layer, it gives me the name of the OpenStreetMap as "OpenStreetMap contributors". For other basemaps, "Name" property provides the name of the basemap in the webmap.
private async Task Initialize()
string webMapURL = "http://ess.maps.arcgis.com/home/item.html?id=e63ed2cd51e94214a434e2951b501c6c";
var webMap = await Map.LoadFromUriAsync(new Uri(webMapURL));
MyMapView.Map = webMap;
IReadOnlyList<Layer> allLyrs = MyMapView.Map.AllLayers;
foreach (Layer l in allLyrs)
Console.WriteLine(l.Attribution); // for the OpenStreetMap only
For this webmap, it displays the result as below:
operations - Incident Areas
operations - Incident Lines
operations - Incident Points
Hope that helps.