I have a problem/question and hopefully someone of you is able to help me:
I have thousands of georeferenced raster files which have corresponding polygons (outer borders of rasters) with a hyperlink in the attribut table to open them in an image viewer. Now I want to load a raster (through selection or whatever) directly with the hyperlink into an MXD Document.
One possibility is
arcpy.MakeRasterLayer_management("G:\\TIFF\RasterXY.tif", "Test")
But now I have only a temporal layer which does not really fit my needs... Maybe someone of you has an idea/solution how to solve this problem.
Thanks, Jann
I tried some things but without any success... Here is my code till now:
import arcpy
data = "Polygone_31-4493"
rows = arcpy.SearchCursor(data, "location")
for row in rows:
cursor_path = row.getValue("location")
rows = arcpy.SearchCursor(data, "location")
rows = arcpy.SearchCursor(data, "image")
for row in rows:
cursor_image = row.getValue("image")
arcpy.MakeRasterLayer_management(cursor_path, cursor_image)
Maybe you have some ideas for this. Thanks
Back again on this topic. After several trys I don't think I will work. Maybe someone has another idea how to do this.
fc = "Shapefile"
path = "location"
image = "image"
path = [row[0] for row in arcpy.da.SearchCursor(fc, (path))]
image = [row[0] for row in arcpy.da.SearchCursor(fc, (image))]
# Enconding the 'u
new_path = [str(item) for item in path]
new_image = [str(item) for item in image]
arcpy.MakeRasterLayer_management(new_path, new_image)
Runtime error
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\management.py", line 6198, in MakeRasterLayer
raise e
RuntimeError: Object: Error in executing tool
I would appreciate any kind of help!
Thanks, Jann