I wonder if anyone has any ideas on the following.
I am using Create Fishnet in an iterative model. The goal being to flip through all features in a feature class and create a fishnet from the bounding coordinates of each individual feature. Fishnet is fed from a feature layer denoted with the %n% keyword but the extents data does not update. The result is the same grid being created over and over again. Is there any way to ensure that the extents are being updated?
import arcgisscripting gp = arcgisscripting.create() gp.overwriteOutput = 1 # input hard-coded but you can make it a script tool parameter to make it an interactive input. in_fc = r"C:\temp\f.gdb\curvepoly" # this polygon feature class has several polygons. rows = gp.SearchCursor(in_fc) row = rows.Next() while row: feat = row.shape ext = feat.extent orig = str(ext.XMin) + " " + str(ext.YMin) yaxis = str(ext.XMin) + " " + str(ext.YMin + 100.00) opp_corner = str(ext.XMax) + " " + str(ext.YMax) print orig, yaxis, opp_corner out_fc = r"C:\temp\f.gdb\fishnetall_" + str(row.OBJECTID) result = gp.CreateFishnet_management(out_fc, orig, yaxis, "0", "0", "5", "8", opp_corner) print(gp.GetMessages()) row = rows.Next() del row, rows
Dan,
Thanks for replying so quickly. I have tried this suggestion exactly. I have a separate model to iterate through a feature class and copy out individual features into their own feature classes, but the create fishnet tool ends up just creating many fishnets on top of each other (one for each feature in the geodatabase). When checking through the log, as the feature classes iterate, they are input into each iteration in the create fishnet tool, but the extents never update to the extents of each feature class
Thank you for letting me know. We have investigated this issue; there is indeed a bug in the tool that affects the extent update in iteration. If you can, please submit a change/fix request to Esri Support; we might get to it a bit quicker.
There is no easy workaround. Hope you can use the script Nobbir provided to get through the process. Sorry about the inconvenience.