Hello
I need some help to work out how to configure create fishnet using a template specified in the parameter of a script tool to create a 2m grid. Im not sure how to get the x and Y values from the template. Thank you for your help its very apprecaited
Output1 = arcpy.GetParameterAsText(0)
Input1 = arcpy.GetParameterAsText(1)
arcpy.management.CreateFishnet(Output1,"","" , '2', '2',None,None,"", "NO_LABELS", Input 1, "POLYGON")
Solved! Go to Solution.
This is the solution I used in the end
desc = arcpy.Describe(Templatelayer)
arcpy.CreateFishnet_management(Grid_layer,str(desc.extent.lowerLeft),str(desc.extent.XMin) + " " + str(desc.extent.YMax),"2","2",None,None,str(desc.extent.upperRight),"NO_LABELS","#","POLYGON")
. Thank you for your help
why not add another parameter and set its default value
size - arcpy.GetParameterAsText(2)
arcpy.management.CreateFishnet(Output1,"","" , size, size,None,None,"", "NO_LABELS", Input 1, "POLYGON")
The size is ok because it is always 2m. It is using the template (another layer) set as a parameter that is the issue when its scripted in python. I get the following error.
thank you so much!
It looks like you have to get the origin from the template featureclass then
This is the solution I used in the end
desc = arcpy.Describe(Templatelayer)
arcpy.CreateFishnet_management(Grid_layer,str(desc.extent.lowerLeft),str(desc.extent.XMin) + " " + str(desc.extent.YMax),"2","2",None,None,str(desc.extent.upperRight),"NO_LABELS","#","POLYGON")
. Thank you for your help