AnsweredAssumed Answered

FeatureLayer source for LabelLayer

Question asked by schlot on Sep 9, 2015
Latest reply on Sep 9, 2015 by schlot

I have featureLayer that is loaded as a FeatureServer so I can add features to it.  Adding to the featureLayer through applyEdits adds graphics to this layer.  I'd also like this layer to be a source for my LabelLayer, so the features I'm adding have a label based on CITY attribute I'm populating.


When I first add the feature to my layer, the text label appears as expected.  However, once I pan, the label changes from the CITY attribute to appearing as 'undefined'.


The CITY attribute is present in layer, I can see it in ArcCatalog, so I know it has values.


      app.bufferLayer = new FeatureLayer(config.pathName + "/arcgis/rest/services/bufferAnalysis/FeatureServer/0" ,{

        var textColor = new Color("#FF0000");
        var cityText = new TextSymbol();
        var cityLabelRenderer = new SimpleRenderer(cityText);
        cityLabelLayer = new LabelLayer({ 
          id: "cityLabels"
        cityLabelLayer.addFeatureLayer(app.bufferLayer, cityLabelRenderer, "${CITY}");[featureLayer,cityLayer,app.bufferLayer,app.graphicsLayer,cityLabelLayer]);  


The is based on the example Select with Feature Layer | ArcGIS API for JavaScript , but instead of just a graphic added to the map, I want to save the circle I'm generating, along with the summary statistics as a new feature in my featureLayer.  It seems like my edits are getting applied, but I don't understand why the labels first appear, then disappear.    Is this not a valid use of labelLayer?