Is This Content Helpful?
We're glad to know this article was helpful.
Why are the Length and Area fields returning zero?
Some storage types, such as Oracle Spatial (SDO_GEOMETRY), do not maintain an Area or Length field. This is noted in the ArcGIS Online Developer help. When queried, such as using identify in ArcMap, these fields return zero and not an error message.
If ArcObjects is being used it is necessary to detect a response of zero for Area and Length and then use the following:
Length: IPolyline.Length, IPolygon.Length
By using these, the length and area are calculated based on the shape object.
... Setup pFeature as IFeature ...
... Setup pFC as IFeatureClass for esriGeometryPolygon ...
Dim strShapeFieldName As String
Dim strLengthFieldName As String
Dim strAreaFieldName As String
strShapeFieldName = pFC.ShapeFieldName
strAreaFieldName = pFC.AreaField.Name
strLengthFieldName = pFC.LengthField.Name
Dim pArea As IArea
Dim pPolygon As IPolygon
Set pArea = pFeature.Shape
Set pPolygon = pFeature.Shape
MsgBox "These may be zero: " & vbNewLine _
& " Area: " & pFeature.Value(pFeature.Fields.FindField(strAreaFieldName)) & vbNewLine _
& " Length: " & pFeature.Value(pFeature.Fields.FindField(strLengthFieldName))
MsgBox "These will never be zero: " & vbNewLine _
& " Area: " & pArea.Area & vbNewLine _
& " Length: " & pPolygon.length