Select to view content in your preferred language

Problems registering polygons

440
2
12-13-2021 09:47 PM
BraulioCordova
Occasional Contributor
I am developing a solution for registering polygons. Through a featureacces service. But I get an error.
 featureForm.on("submit", function () {
      if (editFeature) {      
        const updated = featureForm.getValues();
        editFeature.attributes["id_dist"] = ubigeo;
        editFeature.attributes["anio"] = (new Date()).getFullYear();            
        editFeature.attributes["cep"] = generateUUID();
        editFeature.attributes["estado"] = "Activo";
        editFeature.attributes["nombre_espacio_publico"] = updated["nombre_espacio_publico"];
        editFeature.attributes["tipologia"] = updated["tipologia"];
        editFeature.attributes["dimension"] = updated["dimension"];
        editFeature.attributes["nro_viviendas_colindantes"] = updated["nro_viviendas_colindantes"];
        editFeature.attributes["nro_habitantes"] = updated["nro_habitantes"];
        editFeature.attributes["user_sipcopm"] =usuariosipcopm;
        editFeature.attributes["fecha_registro"] = formatDate(new Date());
        editFeature.attributes["estado"] = "REGISTRADO";
        const edits = {
              updateFeatures: [editFeature]
            };
        applyEditsToIncidents(edits);
        featureLayer.refresh();
        unselectFeature();        
      }
    });
//******************************////////
featureLayer
        .applyEdits(params)
        .then(function (editsResult) {
          if (editsResult.addFeatureResults.length > 0 || editsResult.updateFeatureResults.length > 0) {            
            unselectFeature();
            let objectId;
            if (editsResult.addFeatureResults.length > 0) {
              objectId = editsResult.addFeatureResults[0].objectId;              
              document.getElementById("addFeatureDiv").style.display = "none";
              document.getElementById("updateInstructionDiv").style.display = "none";
              document.getElementById("featureUpdateDiv").style.display = "block";
            } else {
              featureForm.feature = null;
              objectId = editsResult.updateFeatureResults[0].objectId;            
            }
            selectFeature(objectId);            
          }
          else if (editsResult.deleteFeatureResults.length > 0) {
            document.getElementById("addFeatureDiv").style.display = "block";
            document.getElementById("updateInstructionDiv").style.display = "block";
            document.getElementById("featureUpdateDiv").style.display = "none";
            document.getElementById("opcionesfeatureDiv").style.display = "none";          
          }
          featureLayer.refresh();        
        }).catch(function (error) {          
          console.error(
            "[ applyEdits ] FAILURE: ",
            error.code,
            error.name,
            error.message
          );
          console.log("error aqui salio= ", error);
        });
The problem is by geometry. It works with points, but with polygon. It does not allow me. Please a little help.
 

 

Tags (1)
0 Kudos
2 Replies
CourtneyMenikheim
Frequent Contributor

What is the error message?
Are you using the 4.x or 3.x api?
Is this feature layer available for testing? Can you provide an example of one of the Graphics in you applyEdits call?

Courtney Menikheim | Application Developer | @thecmenikheim
0 Kudos
BraulioCordova
Occasional Contributor

4.22

0 Kudos