1

I am unsure how to go about doing this using Python in ArcMap, though I know how to do it by hand. I have geodatabases containing gSSURGO data, one for each state, in their own folders. I have a table that has national datasets of weighted average attributes (found here: https://geonet.esri.com/docs/DOC-2336?sr=stream&ru=9646) that can be joined to the raster layer in the GDB containing the state's gSSURGO data.

Is there a way to batch process this, so that I can create new rasters from joining the raster layer in each states GDB to the national level weighted average data?

It seems it would entail (here follows poor pseudocode):

    Open up the national level table    
    For each folder in the Main Folder (containing the states folders)
        Open up each GDB
        Open up the raster file
        Join the raster file to the national level file based on the one common field
        Create a new raster based on the join
    Merge all rasters into a national raster

I need to end up with a national level raster having merged all these individually joined state raster layers.

2
  • I put an arcpy tag on it to make sure that I and anyone else interested in such questions will have it on their "list". If it is not answered sooner I may get a chance to look at it later and will probably answer more with an approach to the first few steps rather than complete code.
    – PolyGeo
    Sep 23, 2014 at 3:22
  • In the mean time, I am attempting to do it by hand, but it is time consuming and I will have to do the same thing with a different dataset but the exact same data types (but different data) after I make my way thru this.
    – traggatmot
    Sep 23, 2014 at 3:24

1 Answer 1

1

I would start with this part of your pseudo code:

    Open up each GDB
    Open up the raster file
    Join the raster file to the national level file based on the one common field
    Create a new raster based on the join

and, assuming that you are running a Geoprocessing tool for each of those steps, do this once from their tool dialogs and then use Copy As Python Snippet from the Geoprocessing | Results window to copy/paste the four snippets of Python code into an empty Python script.

Once you have those four steps automated in ArcPy you will be in a good position to put it into a for loop and work on any remaining steps.

6
  • I am dragging the parts of the GDB I want to access into the ArcMap window. I'll look into using a tool and coping the python snippets as you suggest.
    – traggatmot
    Sep 23, 2014 at 5:41
  • @traggatmot A key to automating workflows is to identify equivalent tools in the Geoprocessing Framework to ArcMap GUI steps which is often but not always possible.
    – PolyGeo
    Sep 23, 2014 at 5:44
  • I'm looking at it right now, and there seems to be no set tool got the first two steps....For the Join, yes, and mosaic to new raster, yes, but not the first two....
    – traggatmot
    Sep 23, 2014 at 5:46
  • As a new question, rather than via a string of comments on this answer, let's figure out what you mean by Open up the raster file and the equivalent Python code. I suspect that you want to loop through each raster dataset in a file geodatabase which will mean using arcpy.ListRasters() but a question that describes the ArcMap steps precisely for just this bit should make the ArcPy "conversion" easy to provide in an answer.
    – PolyGeo
    Sep 23, 2014 at 5:55
  • Does it make sense to refine this question? Or do you think a new question is definitely needed?
    – traggatmot
    Sep 23, 2014 at 5:56

Your Answer

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

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