Make the output of a arcgis processing tool a feature layer directly

494
4
Jump to solution
10-27-2016 10:32 AM
HannesZiegler2
Occasional Contributor II

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!

0 Kudos
1 Solution

Accepted Solutions
KristenE
New Contributor III

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"

View solution in original post

4 Replies
MitchHolley1
MVP Regular Contributor

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 

0 Kudos
HannesZiegler2
Occasional Contributor II

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!

0 Kudos
KristenE
New Contributor III

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"
HannesZiegler2
Occasional Contributor II

This seems to do the trick, I'm testing it out now. Thank you!

0 Kudos