Legend Status 404 when chaging Labels on DynamicMapServiceLayer in 3.x

389
1
07-12-2019 03:40 PM
LoriEmerson_McCormack
Occasional Contributor

When a user changes a label dynamically, the Legend item for that layer disappears from the Legend and an error saying "unable to load /proxy/?<my map service URL>/legend status: 404" appears in the Console (when looking at the F12 Developer Tools pane).

Here is my code snippet.  What could be causing the legend error?

code:

labelClass = new LabelClass({

labelExpression: newLabel, /* such as [OwnerName] */

labelPlacement: lPlacement, /* such as 'always-horizontal' for polygon */

symbol: new TextSymbol()

});

var drawingOptions = new LayerDrawingOptions();

drawingOptions.labelingInfo = [labelClass];

drawingOptions.showLabels = true;

var options = [];

options[lId] = drawingOptions; /* lId = the layer index */

 

myDynamicLayer.setLayerDrawingOptions(options);

myDynamicLayer.setVisibleLayers(getVisibleLayers());

 

function getVisibleLayers() {

visiblePoints = [];

/* this function finds all the layers that are checked in the layer list and returns an array of layer indexes */

return visiblePoints;

}


Here are the values of the "options" when using the .setLayerDrawingOptions

LayerDrawingOptions values - for - myDynamicLayer.setLayerDrawingOptions

0 Kudos
1 Reply
Noah-Sager
Esri Regular Contributor

Are you still facing a problem with this? If so, could you share a sample app that reproduces the issue?

0 Kudos