It does not work

363
2
07-31-2018 07:36 AM
Abualgheth_J__M_Naji
New Contributor II

I am tring with this python code in arcmap but it doesn't work, who can help me.

0 Kudos
2 Replies
Abualgheth_J__M_Naji
New Contributor II

The problems is in source pnt and target pnt , they took the saime image.

0 Kudos
Abualgheth_J__M_Naji
New Contributor II

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

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

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

0 Kudos