I'm trying to use a polygon supplied by the user to return a single feature class with multiple records in it.
I am clipping from 2 polygons sucessfully, they both have the same attributes.
I then thought I would just stick them into a feature class or set, return that and I would be good to go.
I tried to create a FeatureSet then use .load() to load my results into it.
But I only get the last result from the loop, it only ever returns a single result but I want to return multiple.
arcpy.env.overwriteOutput = True
arcpy.env.workspace = r'C:\Jim\BSelect.gdb'
fcList = arcpy.ListFeatureClasses()
print(fcList)
poly = arcpy.GetParameterAsText(0)
limits = ['Limits_UK_Mosaic',
'Limits_UK_COMORG']
def cliplimit(clippee, clipper, output):
arcpy.Clip_analysis(clippee, clipper, output)
feature_set = arcpy.FeatureSet()
# loop limits and clip tifs
for i in range(len(limits)):
arcpy.AddMessage(limits[i])
output = 'in_memory\\' + limits[i]
cliplimit(limits[i], poly, output)
feature_set.load('in_memory\\' + limits[i])
arcpy.SetParameter(1, feature_set)
There something I dont get about feature class/sets I think not sure.
I just want to return a thing with both results in to my web app but I can only get one atm.
Cheers
Jim
Solved! Go to Solution.
I ended up turning my 2 feature classes into a single feature class and just clipping that, that way all features were clipped together and I managed to return both clipped polygons.
So a workaround rather than an answer but works
I ended up turning my 2 feature classes into a single feature class and just clipping that, that way all features were clipped together and I managed to return both clipped polygons.
So a workaround rather than an answer but works