Questions tagged «count»

2
将arcPy结果对象从arcpy.GetCount_management()强制转换为整数?
我试图通过计算shapefile中有多少点来获取数字。这行得通,除非我随后在其他地方使用该数字时遇到麻烦。最终,我将在一些数学(字段计算器)中使用该计数,但是在调试时,我遇到了一个错误,最终将导致我以后的麻烦。 这段代码: TotalPoints = arcpy.GetCount_management(Path_Pts) arcpy.AddMessage(">>>> PROCESS: COUNT PATH POINTS {" + TotalPoints + "}") 给出此错误: TypeError: cannot concatenate 'str' and 'Result' objects 我尝试将其转换为int,但它也不喜欢: TypeError: int() argument must be a string or a number, not 'Result' 因此,我有一个“结果”对象,需要将其转换为数字。 我该怎么做-或者在这里使用ArcPy函数是不必要的还是过于复杂?


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.