Hello! I am currently working on a python script (isn't my own, just modifying for simlicity), and I am wanting to try and essentially create a temporary layer that another feature class can utilize for attributes and fields. I have a point layer that is being created for addresses within a half mile of feedlots, and with the original script, a line layer was also created to obtain distance information from the address points to the feedlots. The script uses the line layer to 'transfer' the line fields to the address's attributes, but I don't need the lines anymore. I want to try and make the line layer a temporary feature or layer that can be used to call back upon so that the address feature can still obtain the needed information. How would one go about this, and how does the In_Memory function(?) work?
Solved! Go to Solution.
Memory just works as if you were putting that file in a folder called memory.
arcpy.analysis.PairwiseBuffer(
in_features=r"\\...\RLFO Boundary.lyrx",
out_feature_class=r"memory\admu_ofc_poly__PairwiseBuffe",
buffer_distance_or_field="10 Meters",
dissolve_option="NONE",
dissolve_field=None,
method="GEODESIC",
max_deviation="0 DecimalDegrees"
)
When I use it, it's typically like
import os
aprx = arcpy.mp.ArcGISProject("CURRENT")
mp = aprx.activeMap
lays = mp.listLayers("Test*")
for lay in lays:
buff = arcpy.analysis.PairwiseBuffer(
in_features=lay,
out_feature_class= os.path.join("memory", lay.name),
buffer_distance_or_field="10 Meters",
dissolve_option="NONE",
dissolve_field=None,
method="GEODESIC",
max_deviation="0 DecimalDegrees"
)
#other steps
#code
#code
arcpy.management.Delete(buff)
Or if you're feeling lazy you can just not delete it and then close the project when you're done, where it'll then get deleted for you. That may cause performance issues if you have a ton of big stuff in there.
Cant you post what code you currently have?
Memory just works as if you were putting that file in a folder called memory.
arcpy.analysis.PairwiseBuffer(
in_features=r"\\...\RLFO Boundary.lyrx",
out_feature_class=r"memory\admu_ofc_poly__PairwiseBuffe",
buffer_distance_or_field="10 Meters",
dissolve_option="NONE",
dissolve_field=None,
method="GEODESIC",
max_deviation="0 DecimalDegrees"
)
When I use it, it's typically like
import os
aprx = arcpy.mp.ArcGISProject("CURRENT")
mp = aprx.activeMap
lays = mp.listLayers("Test*")
for lay in lays:
buff = arcpy.analysis.PairwiseBuffer(
in_features=lay,
out_feature_class= os.path.join("memory", lay.name),
buffer_distance_or_field="10 Meters",
dissolve_option="NONE",
dissolve_field=None,
method="GEODESIC",
max_deviation="0 DecimalDegrees"
)
#other steps
#code
#code
arcpy.management.Delete(buff)
Or if you're feeling lazy you can just not delete it and then close the project when you're done, where it'll then get deleted for you. That may cause performance issues if you have a ton of big stuff in there.