Troubleshooting label widget
Moved from https://github.com/cmv/cmv-app/issues/642#issuecomment-264847921
@roemhildtg We're giving it a try in a copy of our editor. Looks good for a long time, but ultimately doesn't label. We keep getting an error , maybe one of those still existing bugs you mention. Maybe analyzing the error in the app helps to see what's happening: https://www.hgis-indias.net/cmv-app-master/label/
Anyway, please keep me updated, this seems to be really useful for us, probably not for all layers, but for the "aggregated data" ones, where I can imagine people would want to use different values as labels and there's no need to label more than one of them.
I tried adding labels to the lagos layer (https://www.hgis-indias.net:6443/arcgis/rest/services/HGIS/hgis_fisico/MapServer/1)
The error I get is esri.layers.FeatureLayer: unable to find a field of type 'esriFieldTypeGeometry' in the layer 'fields' information. If you are using a map service layer, features will not have geometry [url: https://www.hgis-indias.net:6443/arcgis/rest/services/HGIS/hgis_fisico/MapServer/1]
This means you don't have your "Shape" field turned on when you published the service. This is highly recommended to have turned on, and it is necessary for Feature layers which the label layer uses.
FYI, I published the service again with all fields turned on!
@Wernazuma I've made some major enhancements to the label widget.
After going back through your original issue, it appears we both had a very similar issue...people want different types of labels and rather than providing a set of 15-20 layaers just for labels, why not let the user create them on the fly?
The new functionality allows exactly this, and you can also set up predefined labels as the developer to enable users to quickly add frequently used/complex label expressions.
https://github.com/roemhildtg/cmv-widgets/tree/master/widgets/LabelLayer
FYI, your app is using an old version of the api (3.14). you may want to try updating to 3.19 and see if anything changes.
Thank you for your update! We'll try that and make a new effort to get it working. This could make our app so much lighter instead of having dozens of "label only" layers. I'm at a conference next week, but I will report back how we fare!
An update: We checked the new version 3.2 but we figured that there is a lot we'd have to work over so we wait for CMV version 2.0 so we don't do redundant work.