Wednesday 27 June 2018

arcgis desktop - Search MXDs for feature class


I've inherited a large somewhat messy database and am attempting to clean it up a bit. Does anyone know if it is possible to search a database to see what arcGIS map documents use a feature class? I'd like to delete old versions of my feature classes, but don't know if they are in use in a mxd somewhere. This would also be useful to see what mxds need to be updated because they're using old versions of data. I'm envisioning a search in ArcCatalog that specifies a feature class and returns a list of mxds and maybe relationships that use said feature class.


Any suggestions appreciated. Thanks in advance!



Answer



Funny this as I've just spent the last few days developing Python code to do this... Chad's link is definitely the page you need to be looking at and PolyGeo's link to the walk function is useful too.


I developed 3 scripts: one for trawling the drive space searching for datasets, a second to trawl for MXDs then extract all the layer information and a third to fix broken links (after everything had been moved to a new folder structure).


Top tips:



  1. You may have 1 or more dataframes to search.

  2. You may have the same dataset duplicated but different featurelayer names.


  3. You may have layers with no featurelayer names.

  4. You may have datasets that are not in any mxds.

  5. You may have datasets referenced in the MXD but do not exist anymore or inaccessible locations such as document and settings.

  6. You will almost certainly have crazy names with superscripts or commas which need dealing with in Python.

  7. I found that the dataset name referenced in the mxd is not necessarily in the same case as what's on the drive so making text matching problematic.

  8. A raster dataset may be simply an image such as a logo so you need to exclude these from your search.

  9. When you use the da.walk function and ask for tables it will return any text file and even asc files for some reason.


You'll need to consider all these scenarios and probably more for your setup.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...