Hello everyone,
I'm facing an issue regarding the addDataFromPath method.
I have used it successfully when I was working with a notebook inside my project to add some shapefiles to a map. However, now I need to convert the notebook into a python script and it is not working. When I run the script I get no errors at all but the shapefiles won't show up on the selected map.
Here's how my code looks like:
project = <project_path>
aprx = arcpy.mp.ArcGISProject(project)
map = aprx.listMaps(map_name) [0]
shape = os.path.join(out_path, out_name_pto)
map.addDataFromPath(shape)
I have also tried the arcpy.MakeFeatureLayer_management function, but it still did not work.
I have been working with the project opened, but I need a way to may the shapefiles to be added whether to the current project or to another project. I have been using the project path, rather than 'CURRENT' for adding the shapefiles.