When creating a layer file with relative paths, the two primary considerations are that 1) the source data file names do not change after the layer file is created, and 2) the layer file and source data remain in the same relative position to one another. These instructions outline the process of creating a layer file with relative paths and can be applied in either ArcMap or ArcGIS Pro.
- Ensure that your ArcGIS project is configured to store relative paths to data sources.
- In ArcMap, open the File menu and select Map Document Properties. Near the bottom of the menu, ensure that the radio button for Store relative pathnames to data resources is checked. Select OK to apply the settings.
- In ArcGIS Pro, relative paths are the default option, no setting changes are needed.
- Create a new folder to prepare your data resource. Make a copy of the data you are publishing into that staging directory. Verify that the staged data is named how you want it in the final product.
- If the new resource data will be stored in an Esri File Geodatabase (FGDB), ensure that the geodatabase is named correctly. A common convention is to use the GDRS resource name as the FGDB name to ensure consistency (see example below).
- In your ArcGIS project, prepare the layer file.
- Verify that the layer is referencing data in your staging directory.
- Verify an appropriate layer name us set in the project Table of Contents.
- Right-click on the layer
- In ArcMap, select Save as Layer File.
- In ArcGIS Pro, select Sharing, then Save as Layer File.
- Save the layer file into the same folder that contains the source data or the source data’s file geodatabase (as in the example below).
- Use a mix of upper- and lower-case text with spaces to name the layer file. The layer file name is used to identify resources in the DNR’s “Quick Layers” add-in. Your data will be more discoverable if users can easily identify the data by its layer file name.
- Most importantly, test the new layer file using one of the following tests:
- Move the staging directory (containing the layer file and source data) to a different network or disk location. Load the layer file into your project and ensure the data still loads. Verify that the data is now sourced from the new directory location.
- Zip the staging directory and send it to a colleague, have them load the layer into an ArcGIS project and verify that the layer draws as intended.
The example below illustrates the directory and file organization for a typical dataResource structure. The source data file types may differ, but the overall structure reflects a common organization that works well.
- env_burrowing_owl_sightings\
- metadata\
- metadata.xml
- metadata.html
- preview\
- preview.jpg
- fgdb\
- Burrowing Owl Sightings.lyrx
- Burrowing Owl Sightings.lyr
- env_burrowing_owl_sightings.gdb
- dataResource.xml
- metadata\