O'Reilly logo

ArcPy and ArcGIS – Geospatial Analysis with Python by Silas Toms

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Inspecting and replacing layer sources

The first and most important arcpy.mapping module use is to identify and fix the broken links between layers in a map document and their data sources. Layer symbology and GIS data storage are separated, meaning that layer data sources are often moved. Arcpy.mapping offers a quick solution, though imperfect.

This solution depends on a number of methods included in the arcpy.mapping module. First, we will need to identify the broken links, and then we will fix them. To identify the broken links we will use the ListBrokenDataSources() method included in arcpy.mapping.

The ListBrokenDataSources() method requires an MXD path to be passed to the MapDocument() method of arcpy.mapping. Once the map document object ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required