laptop and a wrench

漏洞

Using Python as an option with the 'Calculate Field' tool to calculate geometry generates an incorrect field value of '-1' if values in the expression are integers.

上次发布: August 25, 2014 ArcGIS for Desktop
漏洞 ID 编号 NIM059935
已提交August 11, 2010
上次修改时间June 5, 2024
适用范围ArcGIS for Desktop
找到的版本9.3.1
操作系统Windows OS
操作系统版本2008 64 Bit
状态Non-Reproducible

附加信息

No Public Explanation

解决办法

Either cast as a float "float(!shape.area!), or use VB code like so:Dim pMxDoc As IMxDocumentDim pGeometry As IGeometryDim pMap As IMapDim pArea As IAreaDim dArea As DoubleDim dC As DoubleDim sOutMeasure As StringDim bSrefFromMap As Boolean'======================='Adjust the parameters below'bSrefFromMap = True ==> the area will be calculated in the projection of the Map'bSrefFromMap = False ==> the area will be calculated in the projection of the databSrefFromMap = False'unmark the desired output units'sOutMeasure = "Acres"'sOutMeasure = "Square Kilometers"sOutMeasure = "Square Meters"'sOutMeasure = "Square Miles"'=======================If (IsNull([Shape])) Then dArea = -1Else Set pGeometry = [Shape] If (pGeometry.IsEmpty) Then dArea = -1 Else If (bSrefFromMap) Then Set pMxDoc = ThisDocument Set pMap = pMxDoc.FocusMap pGeometry.Project pMap.SpatialReference Select Case pMap.MapUnits Case 3 'Feet Select Case sOutMeasure Case "Acres" dC = 0.00002295684 Case "Square Kilometers" dC = 0.0000000930787 Case "Square Meters" dC = 0.092903 Case "Square Miles" dC = 0.0000000359375 Case Else dC = 1 End Select Case 9 'Meters Select Case sOutMeasure Case "Acres" dC = 0.0002471 Case "Square Kilometers" dC = 0.000001 Case "Square Meters" dC = 1 Case "Square Miles" dC = 0.0000003861022 Case Else dC = 1 End Select Case Else dC = 1 End Select Else dC = 1 End If Set pArea = pGeometry dArea = pArea.Area * dC End IfEnd If

重现步骤

漏洞 ID: NIM059935

软件:

  • ArcGIS for Desktop

当漏洞状态发生变化时获得通知

下载 Esri 支持应用程序

发现关于本主题的更多内容

获取来自 ArcGIS 专家的帮助

联系技术支持部门

下载 Esri 支持应用程序

转至下载选项