Feature Layer Labels Custom Widget

3716
16
Jump to solution
10-26-2016 12:15 PM
AnthonyGiles
Frequent Contributor

Hi All,

i am creating a custom widget that utilises a feature layer created either from a feature collection or a URL to an existing published feature service (I have tried both methods). I want to label the features but I have tried every possibility going with no luck.

if I create a sample HTML page using the 3.18 JS library out side of WAB I can get the labels to appear. I think the issue is setting the map.showLabels to true within the widget.

To experiment a little further I have tried turning the map attribution off within the widget using map.showAttribution = false but this does not work either. I see there is no getter or setter methods for changing these attributes to the map object.

has anyone else managed to get labels to work on a feature layer within a WAB widget? Or is this a limitation of WAB?

Regards

Anthony

0 Kudos
16 Replies
RobertScheitlin__GISP
MVP Emeritus

Anthony,

   Yes that is a big draw back. I have run into other things that I have wanted/needed to change in the jimu.js core for a widget and I have considered building an installer app that will do the changes to the core files and add my widget. That is one route.

0 Kudos
ZdeněkSoldán
Occasional Contributor

Anthony,

I have the same problem as you. I need to create a Feature Layer from FeatureCollection. My layer is a point FL. And I need to show labels on this layer. I have read this thread, add mapOptions.showLabels = true to the jimu.js/MapManager.js as Robert recomanded, add showLabels": true to the config.json as you recomanded but no labels are shown.

I tested FL made from url and it works but FL from FeatureCollection doesn't.

Do you have any suggestions what else should I do?

Thank you for help

Regards

Zdenek

0 Kudos
ErfanGoharian
New Contributor III

Did you find the solution for this? I have the same issue!

0 Kudos
H__DanielRamos_Mendoza
New Contributor III

I have the same problem. I can't see the labels.

I create a layer with FeatureLayer. I don't know where I should deactivate the label.

I added it indicates it but still it does not activate the label

 

H__DanielRamos_Mendoza_0-1688663253255.png

 

 

0 Kudos
H__DanielRamos_Mendoza
New Contributor III

Seguí todos los pasos que indica Robert y Anthony. El detalle de mío que la asignación del valor demora unos segundos. Agregue un SETTIMEOUT y con ello se soluciona el problema.

H__DanielRamos_Mendoza_1-1689096209714.png

 

H__DanielRamos_Mendoza_0-1689096178885.png

 

0 Kudos
H__DanielRamos_Mendoza
New Contributor III

Resultado final 

H__DanielRamos_Mendoza_0-1689096420077.png

 

0 Kudos
H__DanielRamos_Mendoza
New Contributor III

Capa creada dinamicamente para su posterior carga dinamicamente.

H__DanielRamos_Mendoza_1-1689096999552.png

 

0 Kudos