-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Labels
Description
Currently, there is no easy way to exclude basemaps from displaying in the legend. The AGOL viewers do not seem to provide a way to set the showInLegend property for a basemap to false. Also, many basemaps do not contain useful legend information.
In order to hide basemaps in a legend, you have to loop through all "base" and "reference" layers in a basemap and manually set their showInLegend property to false:
map?.load { [weak self] error in
guard error == nil else { return }
self?.map?.basemap.load { [weak self] error in
guard error == nil,
let basemap = self?.map?.basemap else { return }
_ = basemap.referenceLayers.map { ($0 as? AGSLayerContent)?.showInLegend = false }
_ = basemap.baseLayers.map { ($0 as? AGSLayerContent)?.showInLegend = false }
}
}It would be very convenient to have a LegendViewController property to hide all basemap data in a legend, such as:
/// A Boolean value indicating whether to show the basemap layers in the legend.
public var showBasemapInLegend: Bool = trueSee #173
yo1995