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?


#Loop thru rows of input polygons
with 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')
            #arcpy.Copy_management(row, out)
            arcpy.CreateFishnet_management(out, st, orien, '0', '0', '1', '1', labels='NO_LABELS', geometry_type='POLYGON')
  • Does this error occur regardless of whether or not your condition is met?
    – Ali
    Sep 15, 2015 at 11:16
  • Exactly, it occurs whether or not the condition is met. The createfishnet works only when I set the cell height and width to a non-zero value.
    – M Bd O
    Sep 15, 2015 at 12:02

1 Answer 1


If you're specifying an Origin Coordinate and a Y-Axis Coordinate you need to also specify the coordinates for the opposite corner.

In your case something like this should work:

opp = '%f %f' % (ext.XMax, ext.Ymax)
arcpy.CreateFishnet_management(out, st, orien, '0', '0', '2', '2', corner_coord = opp, labels='NO_LABELS', geometry_type='POLYGON')

Alternatively you can provide a template extent derived from the extent of the input feature:

ext = row[0].extent
arcpy.CreateFishnet_management(out, st, orien, '0', '0', '2', '2', template = ext, labels='NO_LABELS', geometry_type='POLYGON')

It's worth noting that if you use the Create Fishnet tool via the dialog box, when you select a template the Origin Coordinate, Y-Axis Coordinate and Opposite Corner parameters are auto-filled. However, when calling from a python script you will still have to specify these values when using a template.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.