Changing a Data source for all layers/feature classes

3704
6
03-07-2017 08:24 AM
MarkItil
New Contributor II

I have a single data source attached to an ArcMap .mxd file.  It contains 6 layers/feature classes.  I want to be able to change the data source location easily for all layers in one step.  I can select each layer and pick the new data source but I'm looking for a way to do them all at once.  I tried right clicking on the Data source but can not find an option to point to a new location.  Reason is I have 100's of mxd files to update and would like to do this quickly.  

I'm currently trying to just see if I can change the data source from one File based GeoDatabase to another (same name) in a new location/path.

I am also looking at connecting to an SDE server rather than the File based GeoDatabase we currently connect to that would contain the same layer names.

Any help would be greatly appreciated.


Thank you,

mark.

0 Kudos
6 Replies
ChrisDonohue__GISP
MVP Alum

On the manual side, it is possible to repair all the links in one shot.

"When the repair to the data link is made from the table of contents, ArcMap repairs the selected layer using the data source you browse to and automatically repairs other broken layers if it can find their data sources in the same location of the data source you specified."

See the Section "Repairing broken links for multiple layers" in this link:

ArcGIS Help (10.2, 10.2.1, and 10.2.2) 

On the automating side, I know many folks have the same issue you have in that they need to update many mxds, so have written Python code to automatically do the re-linking. There is some information on that approach in the link above, in the section "Using the arcpy.mapping module to find and repair data links for a number of map documents".  Hopefully some folks here on GeoNet can post some example code also.

Chris Donohue, GISP

0 Kudos
AbdullahAnter
Occasional Contributor III

Change data source for layers that have same name in  the new source or different name?

0 Kudos
MarkItil
New Contributor II

Same name at this time.  There may be a time when we need to change name.

0 Kudos
AbdullahAnter
Occasional Contributor III

Good that is the name in the new source like the old one.

so the easy method to change all layer at once is :

change the folder name of the old source. so when you open arc map you will find exclamation mark beside each layer

set one of this layers source to the new one and all layer will change automatically.

0 Kudos
MitchHolley1
MVP Regular Contributor

Arcpy has a cool function that does this called replaceDataSource.  Check here:  Layer—Help | ArcGIS for Desktop 

MarkItil
New Contributor II

Thank you to everyone that replied.  I have some great options!!  Many thanks!!

0 Kudos