Building a Script Tool that will take a selected polygon feature iterating through a 1 deg x 1 deg grid feature class. The tool creates a new geodatabase with name from [GEOCELL] field of selected feature (N34W107.gdb). This works.
I need to create a new GDB Feature Dataset with UTM of the selected feature. I'm not sure how to get the centroid of the selected feature x,y into arcpy.GetUTMFromLocation.
layer1x1 = arcpy.GetParameterAsText(0)
output = arcpy.GetParameterAsText(1)
with arcpy.da.SearchCursor(layer1x1, ['GEOCELL']) as geocell_cursor:
for name in geocell_cursor:
exp1 = "GEOCELL = '{}'".format(name[0])
exp2 = "{}".format(name[0])
gdbname = output + "/" + exp2 + ".gdb"
arcpy.SelectLayerByAttribute_management(layer1x1, "NEW_SELECTION", exp1)
arcpy.CreateFileGDB_management(output, exp2)
utm = arcpy.GetUTMFromLocation(x, y)
arcpy.CreateFeatureDataset_management(gdbname, "source_utm", utm)
arcpy.SelectLayerByAttribute_management(layer1x1, "CLEAR_SELECTION")