AnsweredAssumed Answered

mxd.findAndReplaceWorkspacePaths Performance

Question asked by daniel.irwin on Sep 28, 2018
Latest reply on Oct 10, 2018 by Crossrail.GIS

Hi there,

 

So I'm currently trying to transfer a series of MXDs from one organisation to another, the data is exactly the same but the datasource connection has changed.  Trying to use Python automate creating a copy of the MXDs with the new datasource, using the method above, but it has taken 20 minutes so far for an MXD with 1 layer in it (as a test).   The same is true of using the layer.findAndReplaceWorkspacePath method, it's just sitting there "running".  I've turned off the validation of the method but it's still not making any difference.  Should it be this slow?  Could I be doing something wrong?  Code snippet attached (removed sensitive info):

 

import arcpy
mxd = arcpy.mapping.MapDocument(r"mapDocument")
##mxd.findAndReplaceWorkspacePaths(r"oldPath", r"newPath",False)
for layer in arcpy.mapping.ListLayers(mxd):
   if layer.isGroupLayer == False:
      print layer.dataSource
      layer.findAndReplaceWorkspacePath(r"oldPath", r"newPath",False)

 

Is there any way to improve this performance because, quite frankly, if there isn't I'd be better off doing this manually!

Please note this is using ArcGIS Desktop 10.5.1 and Python 2.7, and no, I can't upgrade either (crappy hardware and company policies  )

Outcomes