According to the ArcGIS Pro support pages, "You can add memory datasets to a map in ArcGIS Pro.".
I have a layer in the 'memory' workspace that I would like to add to my current active map. I've tried:
mem_lyr = r"memory\Test_Layer" aprx = arcpy.mp.ArcGISProject("CURRENT") aprx_map = aprx.activeMap aprx_map.addDataFromPath(mem_lyr)
but get the below error. Is there a correct way to add layers in memory to the current map?
Traceback (most recent call last): File "<string>", line 1, in <module> File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\_mp.py", line 1862, in addDataFromPath return convertArcObjectToPythonObject(self._arc_object.addDataFromPath(*gp_fixargs((data_path,), True))) RuntimeError
Most ArcPy functions and GP tools understand the "memory" and "in_memory" aliases, but not all of them. The addDataFromPath method of the ArcPy Map object does not understand or honor it.
I suggest changing your workflow to start with Make Feature Layer (Data Management)—ArcGIS Pro | Documentation and then use addLayer method of Map—ArcGIS Pro | Documentation.