AnsweredAssumed Answered

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

Question asked by lorieme on Jul 12, 2019
Latest reply on Aug 20, 2019 by NSager-esristaff

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

 

Outcomes