9

I have about 50 pdf maps that I would like to batch georeference and/or georectify. I've saved one as a jpg and georeferenced it manually and would like to automate the rest which are in the same location and have the same extent.

enter image description here

The density gradient will change in each case, but the map (saved as jpg now) will have the same extent for all 50 cases.

Does anyone know of a link to a step-by-step tutorial that deals with batch processing in Arcmap 10.2 only? I'm thinking of using the Warp from File code or possibly the Autoregistration option, but am not sure where to start?

The sample code is:

import arcpy
arcpy.WarpFromFile_management(
"\\cpu\data\raster.img", "\\cpu\data\warp_out.tif",
"\\cpu\data\gcpfile.txt", "POLYORDER2", "BILINEAR")
  • Do they occupy the same space? Are the files adjacent to one another? – user681 Jul 12 '14 at 5:30
  • Can you edit your question to include a link to the Wrap from File code that you mention, please? – PolyGeo Jul 12 '14 at 7:24
  • The physical files are located within the same folder. The map data occupies the exact same space across all 50 examples. – Codesurfer Jul 12 '14 at 14:16
15

In your case (jpg rasters and exact same extent for all rasters) the Warp From File tool is just fine.

If you haven't saved a link file yet you should do this first: Georeference one raster in ArcMap, click the View Link Table button and save the links to a text file using the Save button:

View Link Table Then there are different options:

  • Batch: You can use the Warp from file tool in Batch mode by right-clicking it in the toolbox:

Batch

  • arcpy: Change the variables in the following code and run it the way you like. I would just copy/paste it in the Python Window in ArcMap or ArcCatalog.
import arcpy, os

# Variables
arcpy.env.workspace = r"C:\InFolder"    # Folder with rasters to be georeferenced"
OutF = r"C:\OutFolder"                  # Output folder
Suf = "_georef"                         # Suffix added to the output (if necessary)
Ext = ".jpg"                            # Format of the output rasters
LinkFile = r"C:\linkfile.txt"           # Your link file
Transf = "POLYORDER0"                   # Transformation type - to choose from:
                                        #"POLYORDER0", "POLYORDER1", "POLYORDER2", "POLYORDER3", "ADJUST SPLINE" or "PROJECTIVE"
Resampl = "NEAREST"                     # Resampling type - to choose from:
                                        # "NEAREST", "BILINEAR", "CUBIC" or "MAJORITY"

# Process
ListRas = arcpy.ListRasters()
for ras in ListRas:
    basename = arcpy.Describe(ras).baseName
    outpath = os.path.join(OutF, basename + Suf + Ext)
    arcpy.WarpFromFile_management(ras, outpath, LinkFile, Transf, Resampl)
    print "Georeferenced {} successfully".format(basename)
  • ModelBuilder: you can iterate over the rasters with the Rasters Iterator (Insert > Iterators > Rasters). Use %Name%.png in the output path to get your outputs named the same way as the inputs (or %Name%_suffix.png):

enter image description here

  • Thank you. I'm going to try it this evening and will update with the results. – Codesurfer Jul 14 '14 at 23:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.