raster-functions
raster-functions copied to clipboard
How reference many Rasters to other rasters (Warb)
I am try to reference many Rasters to other rasters (Warb) using python code, But I feild, I need help.
import arcpy
i = 0
while i <= 1:
inRasterworkspace = r'C:\Users\AgmnDesk\Desktop\GooleImage\GI_R' #inRasterworkspace = arcpy.GetParameterAsText(0) arcpy.env.workspace = inRasterworkspace inRasters = arcpy.ListRasters() inRaster = inRasters[i]
SoTop=arcpy.GetRasterProperties_management(inRaster , "TOP") SoLeft=arcpy.GetRasterProperties_management(inRaster , "LEFT") SoRight=arcpy.GetRasterProperties_management(inRaster , "RIGHT") SoBottom=arcpy.GetRasterProperties_management(inRaster , "BOTTOM") Source_pnt = '''+ str(SoLeft) + ' ' + str(SoTop) + '' ;' + str(SoRight) + ' ' + str(SoTop) + '' ;' + str(SoLeft) + ' ' + str(SoBottom)+'''
========================
taRasterworkspace = r'C:\Users\AgmnDesk\Desktop\GooleImage\GI2018' #taRasterworkspace = arcpy.GetParameterAsText(1) arcpy.env.workspace = taRasterworkspace taRasters = arcpy.ListRasters('*', 'jpg') taRaster = taRasters[i]
TaTop=arcpy.GetRasterProperties_management(taRaster , "TOP") TaLeft=arcpy.GetRasterProperties_management(taRaster , "LEFT") TaRight=arcpy.GetRasterProperties_management(taRaster , "RIGHT") TaBottom=arcpy.GetRasterProperties_management(taRaster , "BOTTOM") Target_pnt = '''+ str(TaLeft) + ' ' + str(TaTop) + '' ;' + str(TaRight) + ' ' + str(TaTop) + '' ;' + str(TaLeft) + ' ' + str(TaBottom)+'''
========================
arcpy.env.workspace = r'C:\Users\AgmnDesk\Desktop\GooleImage\GI2018' arcpy.env.overwriteOutput = True arcpy.Warp_management(str(taRaster), Source_pnt, Target_pnt, str(taRaster[:-4])+'tif', "POLYORDER2", "BILINEAR")
========================
i = i + 1
Hi @agmna . This repro is specifically used for the python rastrer fucntion API. General arcpy python questions are typically posted on geonet . We can still take a look at it but we may want to move the conversation there so that others can find it for future reference. Where in this code i the problem occurring? Are you getting an error when you run this script?