Store relative pathnames for layers in ArcGIS

By default in ArcGIS 10, full pathnames are stored for all layers you add to a map. This means if you have a file located at c:\data\hydro\rivers.shp that’s used in a map, the full pathname (c:\data\hydro\rivers.shp) to the layer is stored in the map document. ArcMap will always look in c:\data\hydro for the file rivers.shp. Using relative pathnames allows you to move map documents and layers around, as long as the relative locations of the map document and the data don’t change, e.g., as long as the map.mxd map document and the folder data (containing a subfolder hydro with the file rivers.shp, shown below) are moved together, ArcMap will still be able to open the map without issues.

To make the change to relative paths for a single map, choose Map Document Properties… from the File menu and check Store relative pathnames to data sources.

If you want all your new maps to be stored with relative paths you will need to specify relative paths as the default. To do so, click Customize > ArcMap Options… to open the ArcMap Options dialog box, and then click the General tab. Check the option to Make relative paths the default for new map documents. This setting is stored in the registry.

Why should you care about these settings? If you move map documents and data around, say on a flash drive or portable hard drive, these devices can be assigned different drive letters (e, f, g, i…) depending on what computer they are plugged into. If the drive letter changes between sessions and you are using full path names, ArcMap will be unable to find some, or all, layers in your map, and you will be presented with an exclamation point next to the ‘missing’¬†layers:

¬†Speaking from personal experience, it is a pain to have to re-connect more than a few missing layers, and some maps have dozens. What’s the process to fix a missing layer?

  • Open the layer’s properties, either by double-clicking on the layer name or right-clicking on the layer and choosing Properties…
  • Click the Source tab and then the Set Data Source… button, browse to the layer’s location on your computer, select it, click add, then OK.
  • Repeat for each missing layer.

To avoid having to repair any map documents in this fashion, you should either a) never move your map documents and associated files around, or b) use relative pathnames, and store your map documents and data in the same directory (or subdirectories).

Comments are closed.