Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

GetCount_management coding issue

$
0
0
This python code I thought was stating that if projectFile was a polygon and had more than one polygon, dissolve it and make the zoneFile equal to the dissolve file. Otherwise, make the zoneFile equal to projectFile. Ideas? Using ArcGIS 10.1. It is dissolving all polygon shapefiles, regardless of whether there is just one polygon or multiple polygons.

Code:

projectFile = shapefileDir + "\\" + base + ".shp"
if shapeType == "Polygon":
    arcpy.AddMessage(shapeType)
    if int(arcpy.GetCount_management(projectFile).getOutput(0)) > 0: # I also used > 1 with no change
        dissolveFile = geodatabaseLocation + "_Dissolve"
        arcpy.Dissolve_management(projectFile, dissolveFile,"", "", "SINGLE_PART", "DISSOLVE_LINES")
        arcpy.AddMessage("Dissolving multipolygons")
        zoneFile = dissolveFile
    else:
        zoneFile = shapefileDir + "\\" + base + ".shp"

Thank you in advance.

Viewing all articles
Browse latest Browse all 2485

Trending Articles