We are copying data from our corporate office to field offices and we are creating a file geodatabase at these field offices.

We are copying the layers that point to sde and they need to point to the file geodatabase.

I haven't been able to find any information on this. Only info on going from fgdb to sde.

The feature class names will remain the same in the fgdb as they are in sde so all I need to do is change the connection properties.

Can I use python to update the datasource?

  • I assume that you have seen this from the Help. Are you looking for a code example that changes all layer data sources from ArcSDE to File Geodatabases in a single MXD? – PolyGeo Aug 27 '13 at 3:09
  • I have actually utilized some functions such as layer.replacedatasources but I cannot seem to find any example of converting sde layers to gdb. I would like an example code if anyone knows of one. I am just looking for some insight on how this might be done. Thanks. – DWall Aug 27 '13 at 12:00
  • I have seen that. I am using Arcmap 10.0 and I would like to go through a directory with .lyr files and edit those. I was thinking it would be along these lines. lyr.findAndReplaceWorkspacePath(find_workspace_path=lyr.dataSource, replace_workspace_path=r"C:\Newpath\To\GDB.gbd") but no good. – DWall Aug 27 '13 at 12:01
  • 1
    Disregard. I figured it out. I feel like an idiot but I must have been typing something incorrectly. Just do a layer.replaceDataSource and it changes it to file gdb. Sorry... – DWall Aug 27 '13 at 13:12
  • Not an idiot! There are at least 4 methods provided for changing data paths and names in the official docs and it takes a lot of reading and trial and error to finally understand which one to choose for which circumstance. – matt wilkie Jan 7 '15 at 17:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.