Select to view content in your preferred language

Map.addDataFromPath does not add data to path when project instance is created using path.

406
1
04-02-2024 08:40 AM
AdamPatterson
New Contributor

I use a path (not "CURRENT") in order to create a project instance e.g.,:

aprx = arcpy.mp.ArcGISProject("Project.aprx")
m = aprx.listMaps("Map")[0]

I'm confident that I have a reference to the map, as I am able to remove layers from the map using `m.removeLayer(LAYER)`.  However, when I run `m.addDataFromPath(PATH_TO_LAYER)` the Layer is not added to the Map.

When I use "CURRENT" in order to instantiate the project, the Layer is added to the map using m.addDataFromPath(PATH_TO_LAYER).

0 Kudos
1 Reply
DanPatterson
MVP Esteemed Contributor

You need to provide the full path, are you doing this?  I presume the above are just examples, if not, there may be something wrong with your path


... sort of retired...