AnsweredAssumed Answered

Apply many edits to a feature layer applyedits

Question asked by alex.gole_ELDORADOCOUNTY on Dec 16, 2016
Latest reply on Dec 16, 2016 by alex.gole_ELDORADOCOUNTY

Hi all,

 

I am trying to batch insert features (parcels) into a feature layer using feature.applyedits. I am not successful yet. Any tips?

 

Here is what I got: 

 on(dom.byId("createproject"), "click", function () {
                    $("#showattribute").css("display", "inline-block");
                    $("#gifspin").css("display", "inline-block");
                    projectarea.setAttributes({ "START_DATE": Date.parse($("#projectstartdate").val()), "FINISH_DATE": Date.parse($("#projectfinishdate").val()), "Name": $("#projectname").val(), "PROJECT_ID": $("#tesr").val(), "TREE_COUNT": $("#messages").text(), "ACRES": $("#area").text() });

                   
                    //Index array

                    arrayUtil.forEach(projectparcels, function (feature) {
                        feature.setAttributes({
                            "ID": $("#tesr").val(), "OWNER_NAME ": feature.attributes["OWNER_NAME"], "OWNER_ADDR": feature.attributes["OWNER_ADDR"],
                            "OWNER_CITY": feature.attributes["OWNER_CITY"],
                            "OWNER_STAT": feature.attributes["OWNER_STAT"], "OWNER_ZIP": feature.attributes["OWNER_ZIP"],
                            "PRCL_ID": feature.attributes["PRCL_ID"], "SITUSNUMBR": feature.attributes["SITUSNUMBR"], "SITUSSTRNM": feature.attributes["SITUSSTRNM"],
                            "SITUSSTRTY": feature.attributes["SITUSSTRTY"]
                        });
                        featurelayerParcels.applyEdits([feature], null, null, function () {
                            console.log("Parcel updated!");

                        },
                            function (error) {
                                console.log("Features not updated! ", error);
                            });
                    });

...});

Outcomes