The combination of the ArcGIS help, coping "Python snippets" from "Results", and the "Source Assistant" in the Wing IDE will allow you to determine how to format parameters for most of the arcpy functions. However, there are a few that we have to do a little more work with.
All of the parameters we pass into arcpy functions are strings. Most of these are simple but some contain multiple values. Also, when you want to pass "nothing" for a parameter, you sometimes pass a negative one, sometimes a pound sign ("#"), and sometimes something else (i.e. arcpy is not very consistent).
You can use the method shown here to determine the exact format and values for parameters for virtually any toolbox function.
It is common to "crop" large rasters to just the area of interest to have them execute faster. You'll want to do this for this week's assignment and in the future. ArcGIS's "Management -> Clip" tool will do this but the documentation is minimal for how to specify the bounds of the clipping area or the "clip bounds".
In ArcMap, load a raster and then clip it to a specified rectangular area. An easy way to clip any raster to a defined area is to:
In the future you can use this method to determine how to format parameters for arcpy functions. However, the Python Snippets often use functions that have different names or are in different libraries than the ones in the ArcMap documentation.
Some of the tools in ArcMap have text string that represent specific settings that need to be replicated exactly. An example would be specifying units for a buffer which are formatted as "1000 Meters" where 1000 is the amount to buffer by and "Meters" is the units. To determine the exact name for other types of units that are supported, simply execute the Buffer tool in ArcMap with the units you want to use and then copy the Python Snippet to determine the name.
© Copyright 2018 HSU - All rights reserved.