Select to view content in your preferred language

Changing the Symbology of AGSArcGISMapImageLayer

825
2
Jump to solution
07-06-2022 01:57 AM
AfrozAlam
Occasional Contributor

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.

Afroz Alam
0 Kudos
1 Solution

Accepted Solutions
MarkDostal
Esri Regular Contributor

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

View solution in original post

2 Replies
MarkDostal
Esri Regular Contributor

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

AfrozAlam
Occasional Contributor

Dear Mark,

Thanks a lot for reply with solution. It is working fine now.

Afroz

Afroz Alam
0 Kudos