I am adding few layers to map as AGSArcGISMapImageLayer and want to change the symbology of one of the layers (Point feature). Since there is no option of Renderer in above type of layer, so I am unable to change. The code and snapshots are attached for ready reference. As can be seen in the picture, I want to change programitatically the Green Dots . to Red Cross +
I would be very grateful if anyone can help me in this regards.
Thanks & regards,
Afroz Alam
The Center for GIS,
Doha, Qatar.
Solved! Go to Solution.
Hello! Thank you for your question. You are correct, the "AGSArcGISMapImageLayer" does not have an option to change the symbology, but the sublayers of that layer do have that option. They have a renderer property which allows you to set symbology that will be used to render that layer.
You need to find the sublayer you want to change, create a renderer, and assign that renderer to the "renderer" property.
let mapImageSublayer = mapImageLayer.mapImageSublayers[index] as! AGSArcGISMapImageSublayer
let simpleRenderer = AGSSimpleRenderer(symbol: AGSSimpleMarkerSymbol(style: .cross, color: .red, size: 12))
mapImageSublayer.renderer = simpleRenderer
You need to make sure your layers support dynamic layers ("Supports Dynamic Layers: true"). See this blog post for more information.
If you have more questions, let us know!
Mark
Hello! Thank you for your question. You are correct, the "AGSArcGISMapImageLayer" does not have an option to change the symbology, but the sublayers of that layer do have that option. They have a renderer property which allows you to set symbology that will be used to render that layer.
You need to find the sublayer you want to change, create a renderer, and assign that renderer to the "renderer" property.
let mapImageSublayer = mapImageLayer.mapImageSublayers[index] as! AGSArcGISMapImageSublayer
let simpleRenderer = AGSSimpleRenderer(symbol: AGSSimpleMarkerSymbol(style: .cross, color: .red, size: 12))
mapImageSublayer.renderer = simpleRenderer
You need to make sure your layers support dynamic layers ("Supports Dynamic Layers: true"). See this blog post for more information.
If you have more questions, let us know!
Mark
Dear Mark,
Thanks a lot for reply with solution. It is working fine now.
Afroz