Presentation is loading. Please wait.

Presentation is loading. Please wait.

Why python? Automate processes Batch programming Faster Open source Easy recognition of errors Good for data management What is python? Scripting programming.

Similar presentations


Presentation on theme: "Why python? Automate processes Batch programming Faster Open source Easy recognition of errors Good for data management What is python? Scripting programming."— Presentation transcript:

1 Why python? Automate processes Batch programming Faster Open source Easy recognition of errors Good for data management What is python? Scripting programming language Similar to models but text based Design emphasized code readability

2 Three step process to integrate python into your GIS projects... 1.Create model outline in ModelBuilder 2.Customize model in an Python editor, such as PythonWin or IDLE 3.Import script into a ToolBox in ArcCatalog

3 Script for easy data management includes: Main folder: Name of folder determined by user Subfolders: Data, MXD, Images, Other Sub-Subfolder: Working Data Geodatabase: Output Geodatabase and Feature Dataset Create a file management model using ModelBuilder

4 Export as a python script

5 Add descriptions Import necessary modules Change variables to get parameters. Make necessary changes to actual script to match changes Edit script in an editor (I used IDLE)

6 Added descriptions Imported Modules Set Parameters and local variables Run and correct necessary errors

7 Swiss Hillshade Process for Multiple Rasters

8 Create a swiss hillshade model using model builder

9 Export to script

10 Open script in an editing program (IDLE or Pythonwin)

11 Import necessary modules

12 And check out extensions

13 Designate the workspace containing rasters for processing Get Parameter As Text allows the input to be entered as a parameter of the tool

14 Enable overwriting of output

15 Make a list of all the rasters in the workspace “GRID” specifies the raster type The list is created and stored as rasterList but not displayed

16 Create a “for” loop to run the model for each raster Everything indented under this command is performed for every raster in the folder

17 Create a new folder name for each iteration The folder name that stores the output rasters will be “swiss_hs” followed by the name of the input raster

18 Create the folder under a variable

19 Determine which variables are to be dynamic Inputs Outputs Azimuth Z Factor Inputs Outputs Azimuth Z Factor

20 Assign the dynamic inputs to the variables “raster” = the raster in the folder Output folder (created above) and the new raster name

21 Change the process parameters to match the variables *Note: The following code is used for the raster calculation rather than the one that is exported from modelbuilder

22 Copy and paste the processing code and change parameter variables Updating the variables as needed Updating the variables as needed Repeat if desired

23 Enter a print statement to say what folder the new rasters are in

24 Load the script into an ArcGIS toolbox

25 Name the script

26 Select the script

27 Enter the inputs from the script and their type

28 The script can now be run from an ArcGIS Toolbox


Download ppt "Why python? Automate processes Batch programming Faster Open source Easy recognition of errors Good for data management What is python? Scripting programming."

Similar presentations


Ads by Google