I have a shapefile that contains over 100 squares of different sizes and I want to divide each of the squares into quarter sections.
I've written a short python script to do a row iteration and for each square, create a fishnet with 2 rows and 2 columns based on some predefined condition. Since the squares have different sizes, I set the numbers of rows and columns to 2 and set the cell height and width to zero. (Find the script below)
However, I get this error when I run the script although it's only the width/height pair that I set to zero."ERROR 000124: These two pair parameters cannot be zero at the same time"
Any suggestions how I can work around this? Thanks.
SCRIPT:
#Loop thru rows of input polygonswith arcpy.da.SearchCursor(outfc, ['SHAPE@', 'OID@', 'SumNet']) as rows: for row in rows: ext = row[0].extent st = '%f %f' % (ext.XMin, ext.YMin) orien = '%f %f' % (ext.XMin, ext.YMax) #Create fishnet out = os.path.join(gdb, 'fish_{0}'.format(row[1])) if row[2] > threshold: arcpy.CreateFishnet_management(out, st, orien, '0', '0', '2', '2', labels='NO_LABELS', geometry_type='POLYGON') else: #arcpy.Copy_management(row, out) arcpy.CreateFishnet_management(out, st, orien, '0', '0', '1', '1', labels='NO_LABELS', geometry_type='POLYGON')
أكثر...
I've written a short python script to do a row iteration and for each square, create a fishnet with 2 rows and 2 columns based on some predefined condition. Since the squares have different sizes, I set the numbers of rows and columns to 2 and set the cell height and width to zero. (Find the script below)
However, I get this error when I run the script although it's only the width/height pair that I set to zero."ERROR 000124: These two pair parameters cannot be zero at the same time"
Any suggestions how I can work around this? Thanks.
SCRIPT:
#Loop thru rows of input polygonswith arcpy.da.SearchCursor(outfc, ['SHAPE@', 'OID@', 'SumNet']) as rows: for row in rows: ext = row[0].extent st = '%f %f' % (ext.XMin, ext.YMin) orien = '%f %f' % (ext.XMin, ext.YMax) #Create fishnet out = os.path.join(gdb, 'fish_{0}'.format(row[1])) if row[2] > threshold: arcpy.CreateFishnet_management(out, st, orien, '0', '0', '2', '2', labels='NO_LABELS', geometry_type='POLYGON') else: #arcpy.Copy_management(row, out) arcpy.CreateFishnet_management(out, st, orien, '0', '0', '1', '1', labels='NO_LABELS', geometry_type='POLYGON')
أكثر...