Write values ​​immediately when creating

464
2
Jump to solution
01-17-2022 03:04 AM
DavidMrázek
Occasional Contributor II

Hello,

Is there any way to write values ​​directly to the attribute table without having to use an inspector? Some code notation would write the value to the column as soon as the polygon was created.

I have it written like this now, but it clogs me with code and slows down the application:

 

long oid6 = 0;
                        var polygOperation = new EditOperation()
                        {
                            Name = "Tvorba polygonu",
                            SelectNewFeatures = false
                        };
                        polygOperation.Create(polygFeatureLayer, polygonGeometry1, (oid) => { oid6 = oid; });
                        await polygOperation.ExecuteAsync();
                        var inspector6 = new Inspector(true);
                        inspector6.Load(polygFeatureLayer, oid6);
                        inspector6[Nazev] =
                            value1.ToString();
                        inspector6[vyskyt] = 0;
                        inspector6.Apply();

 

 

Isn't there an option like this ?:

 

long oid6 = 0;
                        var polygOperation = new EditOperation()
                        {
                            Name = "Tvorba polygonu",
                            SelectNewFeatures = false
                        };
                        polygOperation.Create(polygFeatureLayer, polygonGeometry1, (oid) => { oid6 = oid; }, polyCursor2.Current[Nazev]=value1, polyCursor2.Current[vyskyt] = 0);
                        await polygOperation.ExecuteAsync();

 

 

I'll be happy for any advice.

I am creating an application in ArcGIS Pro SDK

Thank you

David

0 Kudos
1 Solution

Accepted Solutions
GKmieliauskas
Esri Regular Contributor

Hi,

You can use  Create with other parameters:

var polygFeatureClass = polygFeatureLayer.GetFeatureClass();
var shapeFieldName = polygFeatureClass.GetDefinition().GetShapeField();
Dictionary<string, object> attributes = new Dictionary<string, object>();
attributes.Add(shapeFieldName, polygonGeometry1);
attributes[Nazev] = value1.ToString();
attributes[vyskyt] = 0;
editOp.Create(polygFeatureClas, attributes);

Get polygon

 

View solution in original post

2 Replies
GKmieliauskas
Esri Regular Contributor

Hi,

You can use  Create with other parameters:

var polygFeatureClass = polygFeatureLayer.GetFeatureClass();
var shapeFieldName = polygFeatureClass.GetDefinition().GetShapeField();
Dictionary<string, object> attributes = new Dictionary<string, object>();
attributes.Add(shapeFieldName, polygonGeometry1);
attributes[Nazev] = value1.ToString();
attributes[vyskyt] = 0;
editOp.Create(polygFeatureClas, attributes);

Get polygon

 

DavidMrázek
Occasional Contributor II

Hello,

Thank you very much, so far it looks like it's faster.

0 Kudos