Finding broken data sources in your map document and layer files

Broken data sources are a very common problem with map document files. You can use arcpy.mapping to identify data sources that have moved, been deleted, or changed in their format.

Getting ready

In ArcMap, a broken data connection is signified by a red exclamation point just before the layer name. This is illustrated in the following screenshot. The ListBrokenDataSources() function in arcpy.mapping returns a list of layer objects from a map document or layer file that have a broken data connection:

Getting ready

How to do it…

Follow these steps to learn how to find broken data sources in a map document ...

Get Programming ArcGIS with Python Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.