It's been years since working with ArcPy and I'm having trouble setting up the parameters in my script tool.
What I'm trying to do:
I have a layer file (.lyr) that is a state wide index grid of available elevation model tiles. The layer's attribute table has a field "URL" that contains the download link. In my map document, I want to be able to make a selection of records in the layer and download the elevation model image tiles in my selected project area.
I can run the script tool successfully but it's downloading all 15,000 files in the table not just my selected records.
this is the .py behind my script tool:
import urllib import os import arcpy #where am I saving the download? path = (str(arcpy.GetParameterAsText(1))) os.chdir(path) #path to my index layer...stil unsure how to get this as a dropdown menu item in my tool fc= r"C:\Users\Z\Desktop\LiDAR_Index.lyr" cursor = arcpy.SearchCursor(fc) for row in cursor: field ="URL" link =(row.getValue(field)) head, tail = os.path.split(str(link)) print "Downloading: "+ tail download=urllib.urlretrieve((str(link)), tail)
I'm lost as to how to only make this act on the selected records and not the whole feature class or shapefile.