AnsweredAssumed Answered

Trying to get my layer to work in (Query features from a FeatureLayerView - 4.7)

Question asked by wmobley@tamu.edu on Jun 13, 2018
Latest reply on Jun 14, 2018 by wmobley@tamu.edu

I'm trying to add my own feature layer to the query features from a feature layer. However, when I try, I get a query failed response. I'm not sure what I'm missing. 

Below are the lines that I've changed. I've attached the working code as well. 


        const view = new MapView({
            container: "sceneDiv",
            map: map,
            center: [-94.961833, 29.567433],
            zoom: 9,
            padding: {
                right: 300
            }
        });


const featureLayer = new FeatureLayer({
        url: "http://atlas.texascoastalatlas.com/arcgis/rest/services/IkeDike/InundationDamages/FeatureServer/0",
        outFields: ["*"],
        definitionExpression:"year = 'Present' AND spine = 'False' AND storm = '10' AND slr = 'False'"

    });
map.add(featureLayer);

let graphics;

view.whenLayerView(featureLayer).then(function(layerView) {
    layerView.watch("updating", function(value) {
        if (!value) { // wait for the layer view to finish updating

            // query all the features available for drawing.
            layerView.queryFeatures({
                geometry: view.extent,
                returnGeometry: true
            }).then(function(results) {

                graphics = results;

                const fragment = document.createDocumentFragment();

                results.forEach(function(result, index) {
                    console.log("results:", result)
                    const attributes = result.attributes;
                    const name = attributes.damages + "all the damage"

                    Create a list zip codes in NY
                    const li = document.createElement("li");
                    li.classList.add("panel-result");
                    li.tabIndex = 0;
                    li.setAttribute("data-result-id", index);
                    li.textContent = name;

                    fragment.appendChild(li);
                });
                // // Empty the current list
                listNode.innerHTML = "";
                listNode.appendChild(fragment);
            }).catch(function(e) {
                console.error("query failed: ", e);
            });
        }
    });
});

Attachments

Outcomes