Name of BaseMap in AllLayers property is not set ?

352
1
08-30-2017 11:49 PM
EricDUCOS1
New Contributor III

Hi,

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 ?

Regards.

Tags (2)
0 Kudos
1 Reply
NagmaYasmin
Occasional Contributor III

Hello,

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.Name); 

Console.WriteLine(l.Attribution);  // for the OpenStreetMap only
}

}

For this webmap, it displays the result as below:

OpenStreetMap contributors
operations - Incident Areas
operations - Incident Lines
operations - Incident Points

Hope that helps.

Nagma

0 Kudos