MickeyO-Neil

change the data source of mxd or layer

Discussion created by MickeyO-Neil on Apr 8, 2014
Hello,

I'm trying to change the data source of layers in an mxd-file with a python script and found several possible solutions: e.g.
1. mxd.replaceWorkspaces(...)
2. lyr.replaceDataSource(...)
Both data sources (the new and old one) are an ArcSDE (Oracle), but the Owners are different.
No matter which Function (1 or 2) i use, the data source change works fine but an other problem occurs:
The symbology of one Layer was set to default:
Symbologytype of the Layer: UNIQUE_VALUES
And the Value Field is an other than before the data source was changed.
I have no idea why. The new FeatureClass has the same name as the old one (except the owner-part in front of the Featureclass name) and the Value Field also exists in the new FeatureClass.

Any idea what could be the reason for this?


If I open the mxd-file in ArcMap and set a new datasource (Properties\Source\Set Data Source...) the same problem occurs --> the symbology is gone :(
(I have exported the Layer and attached it as a zip, so you can try to change the data source, yourself)

Thanks
Mickey

Attachments

Outcomes