AnsweredAssumed Answered

How do I filter features out of ArcGISDynamicMapServiceLayer by field?

Question asked by jon.g@39dn.com on Jul 18, 2016

Hello,

I have an app utilizing a ArcGISDynamicMapServiceLayer which I need to return images with features filtered out based on data fields in each layer. While I managed to figure out how to do this, it seems to be breaking layer visibility toggling. The code I am using to accomplish this is below:

ArcGISDynamicMapServiceLayer {

    id : dynamicLayer

    credentials : config.tdnArcGisUserCreds

    url : activeClient.dynamicMapServiceUrl

    Component.onCompleted : {

        app.dynamicLayer = dynamicLayer

    }

    onStatusChanged : {

        if (status == Enums.LayerStatusInitialized) {

            sidePanel.initLayers();

            for (var i = 0, l = dynamicLayer.dynamicLayerInfos.length; i < l; i++) {

                dynamicLayer.dynamicLayerInfos[i].definitionExpression = "FIELD = 'VALUE'";

            }

        }

    }

}

 

This results in filtered dynamic images, but completely disabled layer toggling. This also seems to send out an additional request for each layer every single time a layer is toggled. Despite that, the toggling of the layers doesn't alter the returned image.

 

Does anyone know what I'm doing wrong?

Outcomes