I have a base "fishnet" polygon grid. I attempted to create a model that iterates over each cell in that base fishnet grid and subdivide that cell with the Create Fishnet tool into a new feature class.I expected that I simply would need to set the output from my iterate feature iterator as the 'Template Extent' parameter for the Create Fishnet tool. However, while I can see the name of this iterator output model variable in the drop-down list for the 'Template Extent' parameter; the name does not have the blue Model Variable icon. And more importantly, the template extent does not update at each model iteration. Is there a way that I can make my model recognize aan iteration output as a template extent? ( see screenshot below)[ATTACH=CONFIG]19323[/ATTACH]
import arcgisscripting gp = arcgisscripting.create(9.3) #you will need to modify these two parameters for your situation. This is an ex of a pgdb FeatureClass inputLocation = "\\\\C:\Scratch.mdb" inputFC = inputLocation + "\\exGRID" # Open a search cursor on a feature class rows = gp.searchcursor(inputFC) row = rows.Next() i = 1 while row: gp.AddMessage("Attempting to process polgyon " + str(i)) #Get the shape field shape = row.shape #Get the extent object extent = shape.extent outputName = "Fishnet_" + str(i) outFC = inputLocation + "\\" + outputName #Get the origin (lowerLeft) and y-axis (upperLeft) properties of the polygon ll = extent.lowerleft ul = extent.upperleft ur = extent.upperright originXY = str(ll.x) + " " + str(ll.y) yaxisXY = str(ul.x) + " " + str(ul.y) opp_corner = str(ur.x) + " " + str(ur.y) gp.AddMessage("LowerLeft (x,y): %f, %f" % (ll.x, ll.y)) gp.AddMessage("UpperLeft (x,y): %f, %f" % (ul.x, ul.y)) gp.AddMessage("XMin: %f" % (extent.xmin)) gp.AddMessage("YMin: %f" % (extent.ymin)) gp.AddMessage("XMax: %f" % (extent.xmax)) gp.AddMessage("YMax: %f" % (extent.ymax)) #keep the cell width/height set to zero as it will use the opp_corner to figure it out cellWidth = 0 cellHeight = 0 #plug in the #rows/#cols you want the output grids to contain nrows = 10 ncols = 10 gp.CreateFishnet_management(outFC, originXY, yaxisXY, cellWidth, cellHeight, nrows, ncols, opp_corner) gp.AddMessage("Created " + outputName) i = i + 1 row = rows.Next()
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.