Select to view content in your preferred language

customize layer labels

2761
15
Jump to solution
01-16-2017 09:48 AM
EvonFranklin
New Contributor III

How do i customize layer labels from a MapImageLayer? current layer code below

 var resultsLabelLayer = new MapImageLayer({
                  url: url,
                   sublayers: [{
                                id: 1,
                                labelsVisible: true,
                                visible: true,
                                labelingInfo: [{
                                              labelExpression: "[CONST]",
                                              labelPlacement: "always-horizontal",
                                              symbol: new TextSymbol({
                                                color: [ 255,255,255,1 ],
                                                font: {
                                                  size: 16,
                                                  weight: "bolder"
                                                }
                                              })
                                            }]
                              }]
           });  ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
map.add(resultsLabelLayer);

Using this and adding the layer to the map yields no labels or the layer being drawn

0 Kudos
15 Replies
EvonFranklin
New Contributor III

True worth a try, I will look into turning this on.

0 Kudos
EvonFranklin
New Contributor III

Turns out that does the trick, after consulting the manager and enabling this feature. Thanks for your advice I would not have picked that up from the examples myself.

MichaelVolz
Esteemed Contributor

It would be nice if the sample told you that this was a required setting for your service to work.

MichaelVolz
Esteemed Contributor

When did the MapImageLayer object become available in the JS API (version)?

0 Kudos
EvonFranklin
New Contributor III

Since 4.2 I assume

0 Kudos
Phaelipticus2
New Contributor

Guys,

I´m using 4.15 version.

I´m trying to show the server-side labels on the view but only works with FeatureLayer. But I need to show sublayers on the menu widget, that´s why I have to use MapImageLayer.

There is no problem with my code because I can see the layer in the view. Supported Dynamic Layers = true and put ID on MapImageLayer as well. Checked hundreds of times. I tried what you guys said. 

Anyone have a clue? Is that the 4.15 version to old for MapImageLayer?

Can anyone help? Thanks!

 

0 Kudos