I am tring to warb many rasters to others using python in ArcMap, But I field, I need help.
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
Please place your code in the body of the question. Many will not download and unzip documents for computer security reasons, so you're shutting yourself out from assistance. Be sure to specify what you are attempting to accomplish and what your actual result is, especially any errors (as text, not as an image)
As Vince mentions, you may want to articulate the objective. My question is why are you using a while loop and why do you change workspace environments so many times?
I have two workspaces, because first contain many rasters with correct coordinate , and second workspace contain rasters with incorrect coordinate .
I need to warb rasters in socand worksapce to rasters in first workspace.
Now I see the while loop, but you are limiting yourself to just 2 input rasters, right? ( 0,1)
Even still, changing up your workspace environments can get confusing; it does for me anyway. What if you set variables instead of workspaces like :
in_ws = r'C:\path\to\in\rasters' out_ws = r'C:\path\to\out\rasters'
You might also reconsider the while loop in favor of a for loop like this:
in_raster_list = arcpy.ListRasters() for r in in_raster_list: #do what you need to do #to all of the rasters by using r #as the iterator....
As a matter of personal style, I try to avoid counters, opting rather to step through a list until it's exhausted.
You do one rasterlist, while I have two rasterlist. first one to raster with correct coordinate , and second raster list for rasters with incorrect doordinate.
in other way :
I have 500 rasters had georeferenced , and others (500 rasters) need to georeference .
How I can do georeference second group to first group without using georeference toolbar? because they need long time to use toolbar?
I don't know of a way to georeference rasters/images to ground truthing locations in an automated fashion. Unless each of them are of the exact same area, and even then I'm thinking you'd only be able to reference the corners or extents; that's only 4 points of reference which is borderline at best for for you least mean squares errors...
There are a tool with name (warp) in arctoolbox, it let us to referance image to correct xy data, I try to use this tool in python to referance many rasters, I use the top code. But there is small problem.
By the way, thank you for your tring to help me. And I will try maybe I will get the solution .
Looking at the tool online help, if I understand it correctly you'd need the same number of reference points and control points and then they need to be ordered in such a fashion that RasterPoint1 is 'warped' to ControlPoint1 etc etc. With as many rasters as you have to reference, I don't see how this is possible to automate.
Best of luck.