-
-
Save Rachael-E/ef500ad5b3d455d3780ba3ce2b24a92a to your computer and use it in GitHub Desktop.
Custom renderer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment