Select to view content in your preferred language

mapDoc.save() fails after mapDoc.replaceWorkspaces() in MXD with ArcGIS Image Service

1624
12
01-16-2014 07:48 AM
CarlBeyerhelm
Occasional Contributor
Our organization is migrating from SDE 9.3.1 to SDE 10.1 which entails new SDE connection files.

I've developed a script tool that walks a directory tree looking for MXD files that have an old SDE connection, and then replaces the old SDE connection(s) with the new SDE connection(s) using the .replaceWorkspaces() method.

The script works totally as expeted except for MXDs that contain an ArcGIS Image Service raster layer.  In these situations, the SDE connection to the vector data is successfully replaced but, somehow, that process strips all of the properties from the Image Service layers!

In the attached image below, notice that the SDE connection has been updated to gdb01a as it should, but the Image Service layers are stripped of their source properties.  That causes the MXD to be un-savable when I apply the .save() method.

This seems quite bizarre to me.  Any explanations or remedies would be appreciated.  Thank you...

[ATTACH=CONFIG]30573[/ATTACH]
Tags (2)
0 Kudos
12 Replies
CarlBeyerhelm
Occasional Contributor
For information, this issue has now been registered as a bug with this reference:

NIM098396: arcpy.mapping.replaceWorkspaces will break the data source connection to an Image Service Layer when replacing a workspace in a map document.  Occurs with SDE workspaces, file geodatabases, and shapefiles.
0 Kudos
MichaelVolz
Esteemed Contributor
Did ESRI give an estimate on when they might be able to fix this bug?

Are you going to us the alternate ReplaceDataSource method to process your SDE layers?
0 Kudos
CarlBeyerhelm
Occasional Contributor
Hi Micheal.

No specific time frame was given for fixing the issue, but ESRI did confirm that the bug persists through versions 10.2 and 10.2.1, and that a member of their development team has taken the issue on.

Although lyr.replaceDataSource() would work, I elected to use mapDoc.findAndReplaceWorkspaces() as it is faster than iterating through each TOC layer.
0 Kudos