Hyperlinks allow you to access documents or Web pages related to features. These hyperlinks can be accessed for each feature using the Hyperlink tool on the Tools toolbar. This topic describes how to set and use hyperlink properties for a map layer.
Hyperlinks have to be defined before you use the Hyperlink tool, and they can be one of three types:
- Document—When you click a feature with the Hyperlink tool, a document or file is opened using its appropriate application (such as Microsoft Excel).
- URL—When you click a feature with the Hyperlink tool, a Web page is launched in your Web browser.
- Script—When you click a feature with the Hyperlink tool, a feature value is sent to a script. This option enables the use of customized behavior.
You can define a hyperlink for the features in a layer either by defining a dynamic hyperlink or using field-based hyperlinks.
An alternative, and often more flexible, tool is available that uses HTML pop-ups. Clicking features reports additional information and attributes using HTML and Web methods.
Defining hyperlink properties
- Right-click the layer for which you want to set hyperlink properties and choose Properties.
- Select the Display tab on the Layer Properties dialog box.
- Check Support Hyperlinks using field.
- Select the field name you wish to use for your hyperlink and the link type — Document, URL, or Script. If you choose to use a script, use the Edit button to write your script using JScript or VBScript. Then, click OK.
- Click OK or Apply on the Layer Properties dialog box.
- On the Tools toolbar, click the Hyperlink tool . This transforms your mouse pointer into a lightning bolt.Note:
Any visible features in the map that have hyperlinks defined are drawn in blue, the default color, or outlined in blue in the case of polygons. When you are over a feature for which a hyperlink exists, the mouse pointer turns into a black lightning bolt with a flash, and you see a pop-up tip with the name of the target.
- Click a desired feature or location in your data frame to access hyperlink information.
- This will bring up the hyperlink information such as an HTML Web page.
- If you have hyperlinks turned on for multiple layers, clicking a location in your data frame provides a Hyperlinks dialog box to choose a feature from one of the layers. The layer name is listed in parentheses.
Changing the hyperlink color for features
You can use ArcMap settings to set the color for displaying hyperlink features using the following steps:
- Click Customize > ArcMap Options.
- Click the General tab.
- Check When the Hyperlink tool is selected, highlight features containing clickable content.
- Click the color drop-down menu to specify a different color for the highlights.
Defining dynamic hyperlinks through Identify results
You can dynamically add a hyperlink to a feature using the Identify tool . With dynamic hyperlinks, you do not use an attribute field to supply the hyperlink targets. The hyperlink target you specify is associated with the identified feature. This association is stored with your layer.
- Click the Identify tool on the Tools toolbar.
- Click the feature for which you want to define a hyperlink.
- Right-click the feature in the Identify window and click Add Hyperlink.
- Specify the desired hyperlink target.
The Hyperlink Base setting has no effect on dynamic hyperlinks.
After deleting features from a shapefile, you may find that dynamic hyperlinks are attached to different features. This occurs because ArcMap uses the feature ID (FID) field to associate dynamic hyperlinks with features, but the FIDs of shapefiles must be recalculated when features are deleted. To ensure hyperlinks are always associated with the proper features, only use dynamic hyperlinks with geodatabase features classes (geodatabase features always have unique ID values). Field-based hyperlinks can be used with shapefiles without this limitation.
Managing hyperlink paths
As part of a map's properties, you can specify a hyperlink base, which is the base path or URL used for field-based hyperlinks to documents or URLs. For example, if the hyperlink base is set to D:\Data, then the values in the field or fields used as hyperlinks to documents don't have to contain D:\Data. They can just contain the name of the file.
The Hyperlink Base property is specified on the Map Document Properties dialog box. Click File > Map Document Properties to open. If the location of the targets changes, you can simply update this one setting instead of having to edit each value of the field providing the hyperlink targets.
Making hyperlinks with relative paths
Sometimes, you may want to give a map that contains hyperlinks to someone who does not have access to your network resources. Just as you can save the map with relative paths to the data, you can also specify hyperlinks that refer to a location relative to the map.
To specify a path to a document in the same folder, type the document's name. For the example below, you would type directions.bmp (that is, do not include a \ or drive letter prefix).
To specify a path through a folder immediately below the map's location in the file system, start the path with the folder name (again, no \ or drive letter prefix). For the example below, you would type Graphics\directions.bmp.
Using parameters to control how a program opens a hyperlinked document
Hyperlinks to documents can contain parameters that define how the program opens the document. For example, parameters can tell Adobe Reader to open a PDF to a specific page, allowing map features to hyperlink to different pages in the same document. Since each software package (such as Microsoft Word, Microsoft Excel, Adobe Reader, and so on) has unique commands, consult the documentation for the software package used to open the document for the parameters and syntax available to it.
Many times, these parameters will be provided for use in a command line. For example, to open a .PDF document to page 5, the command line might look like the following:
- "C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe" "/A "Page=5=OpenActions"" "c:\temp\PopulationData.pdf"
- "C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe" is the location of the software; "/A "Page=5=OpenActions" is the open parameter; and "c:\temp\PopulationData.pdf" is the location of the file.
ArcGIS does not read these parameters like a command line. Instead, it uses a special delimiter, a ? (question mark), to separate the file path from the parameter. The hyperlink to the same document and page in ArcGIS would look like this:
- c:\temp\PopulationData.pdf ?/A "Page=5=OpenActions"
The ? serves as the delimiter between the path and the parameter.