[GIS] Repairing link between shapefile and layer file

arcgis-10.2arcgis-desktoplayer-fileshapefile

every time I open the same lyr file I have to do data/repair data source (link to the shp file).

I tried to save/export that shp file again, and create the new layer file as well, but every time the same thing happens. The Arc does not remember the link between these two.

Moreover, when I define the data source and the shp file appears in Arc, I have to define the symboloy from scratch (via properties/symbology/import dialogue)

Any ideas how to permanently define the link between the shp and layer file in ArcGIS 10.2 for Desktop? (When drag lyr file to automatically link the shp file)

Best Answer

As you can see from the comment thread above, layer files and relative paths are a bit complicated.

The problem is that a layer file (*.lyr) can either hold absolute paths or relative paths, but there doesn't seem to be any (easy) way to ascertain which it uses, after the layer file has been created.

To create a layer file with relative paths, there are two options:

  • in ArcMap, choose > File > Map Document Properties > Store Relative Paths, then right-click on the layer and Save As Layer File; or
  • using the Save To Layer File geoprocessing tool, choose relative paths

(Obviously to choose absolute paths do the above with the other option chosen.)

So in your situation it sounds like you might need to recreate your layer file using either absolute paths or relative paths (depending on your workflow):

  • add the broken layer file to ArcMap
  • repair the source
  • re-save a new *.lyr file using the appropriate path option
  • delete the existing broken *.lyr file