// Change the web map renderer to a customised one | |
private func changeFeatureLayerRenderers(for map: AGSMap) { | |
// Get the feature layer containing the munro mountains point data | |
if let munroLayer = map.operationalLayers.object(at: 1) as? AGSFeatureLayer { | |
// Turn off labels | |
munroLayer.labelsEnabled = false | |
// Create custom renderer from mountains.png | |
let munroSymbol = AGSPictureMarkerSymbol(image: UIImage(named: "mountains")!) | |
munroSymbol.height = 40 | |
munroSymbol.width = 40 | |
munroLayer.renderer = AGSSimpleRenderer(symbol: munroSymbol) | |
} | |
// Get the feature layer containing the national park polygon data | |
if let parkLayer = map.operationalLayers.object(at: 0) as? AGSFeatureLayer { | |
let parkLineSymbol = AGSSimpleLineSymbol(style: .solid, color: UIColor.black, width: 1) | |
let parkSymbol = AGSSimpleFillSymbol(style: .null, color: UIColor.clear, outline: parkLineSymbol) | |
// Create custom renderer | |
parkLayer.renderer = AGSSimpleRenderer(symbol: parkSymbol) | |
} | |
} |