AnsweredAssumed Answered

How to create a feature in a feature class with ArcPy

Question asked by jsn on Apr 23, 2018
Latest reply on Apr 23, 2018 by Dan_Patterson

Hello everyone,

 

How can I create a point feature in a feature class with ArcPy the same way I do it with vb.net

I need to convert this vb.net code into Python code.

 

Dim workspaceEdit As IWorkspaceEdit = CType(myTargetIWorkspace, IWorkspaceEdit)

'' Start an edit session. An undo/redo stack isn't necessary in this case.

workspaceEdit.StartEditing(False)

''/ Start an edit operation.

workspaceEdit.StartEditOperation()

Dim feature As IFeature = pFeatureClass.CreateFeature()

feature.Shape = pPoint

feature.Value(feature.Fields.FindField("ID")) = IncidentID

feature.Value(feature.Fields.FindField("ADDRESS")) = Address

feature.Value(feature.Fields.FindField("XCOORD")) = pPoint.X

feature.Value(feature.Fields.FindField("YCOORD")) = pPoint.Y

feature.Value(feature.Fields.FindField("PROBDESC")) = ProblemDescription

feature.Value(feature.Fields.FindField("REQSTDATE")) = DateTime.Parse(RequestedDate.ToString)

feature.Store()

''// Save the edit operation. To cancel an edit operation, the AbortEditOperation

''// method can be used.

workspaceEdit.StopEditOperation()

''// Stop the edit session. The saveEdits parameter indicates the edit session

''// will be committed.

workspaceEdit.StopEditing(True)

Outcomes