I have been working on a project and have gotten to the following point:
I have been able to create a Feature Class, here named GeocodedDonationLocations. This was successfully done with arcpy.geocoding.GeocodeAddresses
.
Next, I am attempting to add this to the current map in ArcGIS Pro. So far, I have been able to come up with the following:
ResultPath1=r"E:\OneDriveMain\OneDrive\_GISProjects\2023Projects\ProjectLeo\Default.gdb\GeocodedDonationLocations"
layername="Donation Locations"
arcpy.management.MakeFeatureLayer(ResultPath1,layername)
p=arcpy.mp.ArcGISProject("current")
m=listMaps("Map")[0]
m.addlayer(layername,"TOP")
I know that I want to create a layer out of the feature class first, which is why I am using MakeFeatureLayer
above. It is the 'Actually adding it to the map' part that I seem to have a lot of trouble with.
The main error that I am getting is OSError: current
, which makes me think I am not understanding that particular line.
I am also unsure if I am using listMaps correctly...
I have been writing this is PyCharm, and not directly inside ArcGIS Pro (no python window or toolbox or notebook so far).