Repairing a broken data source for a single layer in multiple map documents

المشرف العام

Administrator
طاقم الإدارة
Python Newbie

Okay, this should be the most basic thing to do and yet I can't find a solution to my problem. I'm trying to repair the data source for an aerial raster in close to 50 individual map documents. My supervisor deleted the 2014 recently and uploaded the 2015 in its place. The new raster is in the same workspace and has virtually the same path, just a different name. This is the template I was working with from ArcGIS resources. How would I need to modify it for the task at hand? Thank you very much for the help.

import arcpymxd = arcpy.mapping.MapDocument("C:\Project\Project.mxd") #I'd like to create a list

for lyr in arcpy.mapping.ListLayers(mxd): if lyr.dataSource == (r"C:\Project\Data\Aerial\SID_2014"): lyr.replaceDataSource(r"C:\Data\Aerial\SID_2015", "SHAPEFILE_WORKSPACE", "SID_2015")



أكثر...
 
أعلى