1

I have a set of images that I need to georeference. All images have the exact same geographical coverage. I have used the georeferenceing tool bar to create a link file.

I then used the script suggested in Batch Georeferencing in ArcMap/ArcPy? to loop through the images.

arcpy.env.workspace = r"inputFolderPath"    # Folder with rasters to be georeferenced"
arcpy.env.outputCoordinateSystem = r"pathToLinkTable.prj"   #output projection
OutF = r"pathToOutputWorkspace"                         # Output folder
Ext = ".tif"                            # Format of the output rasters
LinkFile = r"pathToLinkFile.txt"           # Your link file
Transf = "POLYORDER0"                   
Resampl = "NEAREST"                     

# Process
ListRas = arcpy.ListRasters()
for ras in ListRas:
    basename = arcpy.Describe(ras).baseName
    outpath = os.path.join(OutF, basename + Ext)
    arcpy.WarpFromFile_management(ras, outpath, LinkFile, Transf, Resampl)
    print "Georeferenced {} successfully".format(basename)    

All images are processes, however the output images/rasters are not in the expected geographic location.

I cannot see where the issue is. It must be in the source points/map points, but I am using the link table... any ideas what I should try next?

I am running the script in IDLE, as the python command line crashes when I try to run anything (unrelated issue but relevant information).

5
  • 2
    Do you need to set the spatial reference the rasters were georeferenced to? Although the images have the same geographical coverage the from points may be different depending on how the images were obtained.. so you might get some slight difference. Are your input images GRIDs? if not you're going to get double extensions like image.jpg.tif or image.tif.tif, use the os.path.splitext(ras)[0] to get the file name without extension - don't forget to import os first. Commented Apr 27, 2018 at 0:04
  • Have you asked a question about your python from (presumably) the ArcCatalog python window crashing? That sounds like something that needs to be fixed but will definitely need to be a different thread i.e. a new question. Commented Apr 27, 2018 at 0:29
  • I was using the ArcMap python window (I didn't know they were different). I will try with the ArcCatalog python window. It's a new issue and I need to get this work done as top priority. Commented Apr 27, 2018 at 1:35
  • 2
    There are subtle differences between Catalog and Map but neither should crash. Consider running the script in CMD if you're on Windows to avoid any bias. Commented Apr 27, 2018 at 1:37
  • RE setting spatial reference of rasters. The images (tifs) are iterations of hydrodynamic model output, therefore have the exact same extent by default. Doing the analysis this way (a sub-optimal) is a work around to start with. Commented Apr 27, 2018 at 1:38

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.