I'd like to make the output of a geoprocessing tool a feature layer because I don't want to specify a location for the output to be saved to, I just need to operate on it for a little and then discard it.
I started to type MakeFeatureLayer in the outfc parameter but then realized this doesn't work. Is there a way to make a feature layer directly from a geoprocessing tool?
Thanks for any help!
Solved! Go to Solution.
You could use the in memory workspace. Then the feature class only exists in memory and will be discarded after the script is finished running.
import arcpy
arcpy.env.workspace = "in_memory"
Can you post the Python code you're trying to run. Don't forget to format it properly. See here: https://community.esri.com/docs/DOC-8691-posting-code-with-syntax-highlighting-on-geonet
Yes sure, basically I want the output of the Intersect tool to be a temporary Feature Layer such as those created by arcpy.management.MakeFeatureLayer.
arcpy.analysis.Intersect([inline, infc_intersect], outfc_intersect, "", "", "POINT")
Otherwise, I need the user to specify a location for this temporary point file (in outfc_intersect), and I don't want this as it adds unnecessary complexity.
Thanks!
You could use the in memory workspace. Then the feature class only exists in memory and will be discarded after the script is finished running.
import arcpy
arcpy.env.workspace = "in_memory"
This seems to do the trick, I'm testing it out now. Thank you!