ArcMap 10.1 hyperlinks with python code

926
0
09-16-2016 09:46 AM
JoeyDiehl
New Contributor

Should the python code below for hyperlinks in ArcMap 10.1 with python 2.7 installed?

import arcpy
def OpenLink ([PARCEL]):
parcel = [PARCEL]
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0]
subID = parcel[1:7]
folder = "rc" + subID[:1] + "00000"
filename = "s" + subID + "f.tif"
rasterPath = "r:\\rectsubr\\" + folder + "\\" + filename
lyr = arcpy.MakeRasterLayer_management(rasterPath, filename)
arcpy.mapping.AddLayer(df, lyr, "TOP")
return

This code works in ArcMap 10.2 and up. 

0 Kudos
0 Replies