kentrothrock

Problem Creating Features in ArcObjects

Discussion created by kentrothrock on Aug 19, 2010
Latest reply on Aug 20, 2010 by vtammineni
Hello all.

I've got some code (attached) that intersects a selected parcel with a soils layer, then creates a feature class in a file geodatabase with the requisite data, then adds said feature class to ArcMap for further manual editing.

The feature class gets created OK and gets all the requisite attributes, but is absolutely uneditable. To boot, I notice that the 'shape_area' and 'shape_length' fields are null and am guessing that's a symptom of the underlying problem.

Any ideas?

I've attached the code in its entirety, but here's where I think the problem is:

__________________________________________________ ___________________________________

Dim pWS As IWorkspace = OpenFGDBWorkspace()
Dim pFWs As IFeatureWorkspace = pWS
Dim pNewFC As IFeatureClass = pFWs.OpenFeatureClass("P" & pinNoDash)

Dim newFCSTIndx As Integer = pNewFC.Fields.FindField("SoilType")
Dim newFCAcresIndx As Integer = pNewFC.Fields.FindField("Acreage")
Dim pWSEdit As IWorkspaceEdit = pFWs
Dim pArea As IArea

Dim pFBuf As IFeatureBuffer = pNewFC.CreateFeatureBuffer()
Dim pInsCur As IFeatureCursor = pNewFC.Insert(True)

Dim pG As IGeometry

Try
Do Until parFeat Is Nothing
pGeom = parFeat.ShapeCopy
pSoilsCur = PerformSpatialQuery(pSoilsFC, pGeom, esriSpatialRelEnum.esriSpatialRelIntersects, Nothing)
soilsFeat = pSoilsCur.NextFeature
soiltypeIndx = soilsFeat.Fields.FindField("DSL_NAME")

Do Until soilsFeat Is Nothing

pTopoOp = soilsFeat.ShapeCopy

outPoly = pTopoOp.Intersect(pGeom, esriGeometryDimension.esriGeometry2Dimension)
pG = outPoly

pGeometryColl = outPoly

pArea = outPoly

pFBuf.Shape = pG 'outPoly
pFBuf.Value(newFCSTIndx) = soilsFeat.Value(soiltypeIndx)
pFBuf.Value(newFCAcresIndx) = pArea.Area / 43560

pWSEdit.StartEditing(False)
pWSEdit.StartEditOperation()
pInsCur.InsertFeature(pFBuf)
pWSEdit.StopEditOperation()
pWSEdit.StopEditing(True)

'If pGeometryColl.GeometryCount.ToString Then

'End If

'MsgBox(pNewFeat.OID)

'FlashGeometry(outPoly, aColor, screenDisplay, 1000)
soilsFeat = pSoilsCur.NextFeature

Loop

parFeat = pFCur.NextFeature
Loop
Catch ex As Exception
MsgBox(ex.Message)
Finally
Marshal.ReleaseComObject(pInsCur)
Marshal.ReleaseComObject(pFCur)
End Try

__________________________________________________ ___________________________________

Thanks in advance!

Attachments

Outcomes