Last active
March 15, 2019 22:36
-
-
Save pdbartsch/9c09aefe399124a80809c4d90244fc45 to your computer and use it in GitHub Desktop.
Simple example of updating a single mxd file that has missing sources when data is moved to a new folder. For more information see: http://desktop.arcgis.com/en/arcmap/10.6/analyze/arcpy-mapping/updatingandfixingdatasources.htm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import arcpy | |
mxd = arcpy.mapping.MapDocument(r"C:\Projects\arc_examples\broken_sources_example.mxd") | |
original_directory = r"C:\Projects\arc_examples" | |
new_directory = r"C:\Projects\arc_examples\data_moved_to_this_folder" | |
mxd.findAndReplaceWorkspacePaths(original_directory, new_directory) | |
mxd.saveACopy(r"C:\Projects\arc_examples\data_moved_to_this_folder\new_map.mxd") | |
del mxd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment