AnsweredAssumed Answered

Import Symbology From a Layer File Using Relative Paths and Python

Question asked by gabrisch on Oct 27, 2015
Latest reply on Oct 27, 2015 by gabrisch

I have a Model Builder model that uses a feature set to l prompt the user to draw a line in the data view.  The model calls a Python script and calculates the true north azimuth of that line, labels the line with the azimuth value, and adds that new layer to the table of contents (all outside of an edit session!).


My problem---I have a layer file stored in the same directory as the toolbox, model, and script.  The layer file stores symbology (which is an arrow head and the end of the line).  In the script I can define a full path to the layer file to import symbology to the newly created line, but I am looking to use relative paths to define that symbology so that when I share the tool, the user will not have to alter any code.


I know from the ESRI help that

You cannot type relative paths (using the dot and double-dot notation) in any ArcGIS application. Nor can you use relative paths in Python scripts.  A relative path cannot span disk drives. For example, if your current directory is on drive D, you cannot use relative paths to navigate to any directory on the E drive.


But, since I am using an ArcGIS Feature Set via a model to get the input from the user I wonder if there is some workaround.