POST
|
Hello Randy, Just tried this script and it worked! Thank you very much. I also made a dictionary for renaming a bunch of shapefiles as you recommended. Thank you! Jerome
... View more
01-18-2018
02:09 AM
|
0
|
0
|
1028
|
POST
|
Hello Dan, Thanks for this. this is our situation, we have a shp file named "earthquake_PHI.shp", and we renamed it manually to "earthquake_PHL.shp". This shapefile was used in over 700 mxds. we checked these mxds, and the links got broken. We wanted to find a way on how to set the data source again but with the newly renamed shpfile. By the way, we still need to rename 70 shapefiles. Thank you very much!
... View more
01-14-2018
10:37 PM
|
0
|
0
|
1028
|
POST
|
Hello Xander, Thanks for your reply. Yes, i run the code in version 10.1 and even tried it in version 10.3. We modify the code by specifying the old and new locations and names of the shapefiles and we run the code. The code works fine and there are no error messages, however, when we check the mxds, links are still broken.
... View more
01-14-2018
10:31 PM
|
0
|
0
|
1028
|
POST
|
Hello Randy, Thanks for this. Yes, we are working with shp files and not with features in a geodatabase. We're here in this situation where we have a shp file named "earthquake_PHI.shp", and we renamed it to "earthquake_PHL.shp". This shapefile was used in over 700 mxds. we checked these mxds, and the links got broken. We wanted to find a way on how to set the data source again but with the newly renamed shpfile. "Was there a process to the renaming that can be code?" We just renamed the shp and its extensions (.dbf, .shx, etc) manually inside a folder. We have another situation where we didn't rename the shpfile ("earthquake_PHI.shp") anymore, instead we 'save as' another file called "earthquake_PHL.shp". In this case, we have now 2 shapefiles. Checking the mxds, links are not broken but the layer in mxd still has the old shapefile as its source, but we wanted to change it to the new shapefile by setting the data source. Is this possible with a script to set the data source in 700 mxds? Thank you very much!
... View more
01-14-2018
10:24 PM
|
0
|
2
|
1028
|
POST
|
Howdy! I had a bunch of shp files inputted in my mxds. and we renamed these shp files and the link in my mxds got broken. The easiest way is to open the mxd, set the data source and click the renamed shp files or use the arc catalog. However, I need to do the fixing of broken links to 700 mxds., this can be overwhelming. I am trying to find a python code/script that can be used in order to fix these broken links but unfortunately, I can't find any that works. Can anyone help me with this? It will be greatly appreciated if anyone can give me a script for this. Ps: I tried using this script from ArcGIS Help 10.1 but it is not working import arcpymxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")for lyr in arcpy.mapping.ListBrokenDataSources(mxd): if lyr.supports("DATASOURCE"): if lyr.dataSource == r"C:\Project\Data\Transportation.gdb\MajorRoads": lyr.replaceDataSource(r"C:\Project\Data\Transportation.gdb", "FILEGDB_WORKSPACE", "Highways") lyr.name = "Highways"mxd.saveACopy(r"C:\Project\Project2.mxd")del mxd
... View more
01-12-2018
01:28 AM
|
0
|
8
|
1357
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:25 AM
|