Saturday, May 16, 2015

Module 1 - Running a Folder Creator Script

Welcome to Module 1 of GIS Programming! This week's assignment consisted of lecture and readings introducing us to Python followed by some exercises and a short lab. Briefly, Python is a programming language that was created by Guido van Rossum in the Netherlands and released in 1991. The software is easy to use, free and open source, can be supported on different platforms, can be run directly from the source code (aka interpreted), and is object oriented, working with collections of objects as opposed to lists of tasks. It is also both a scripting and programming language, although programming capabilities are less robust than other dedicated programming languages, such as C++. All these qualities have led ESRI to use Python as the preferred scripting language for ArcGIS. Well that's the textbook history and explanation as noted in Python: Scripting for ArcGIS by Paul Zandbergen (2013), but what is Python to me?

To me, Python will be a way to automate workflows, increase efficiency, create new tools, and expose me to working with code. It's a useful and well-known language that will assist me in completing GIS projects and securing employment after my certificate program is done. And who knows, I may find I really like it! I certainly have enjoyed the little bit of scripting we did last semester.

For this week's lab, we were simply asked to run a provided script that would create all the folders we will need to store our course data and deliverables. Using PythonWin as my IDE (integrated development environment) or editor, I opened the script and clicked on the Run button in the toolbar. There are multiple ways to tell a script to run, including the button I used, clicking File-Run, or double-clicking on the script file. When I opened my student drive, there was the main GIS Programming folder and all the folders within that. See below for a screenshot of my scripted folder creation.

At first I wasn't sure how to know the script had run or finished running, then I read at the bottom of the script "print Process Complete" as the final input. I realized my script window was covering my interactive window, so once I moved it, I was able to see that "Process Complete" was next to the prompt, telling me the script had run and was finished. Good lesson to remind myself to arrange the editor windows to show both the scripts and the messages. Next up, creating my own scripts or at least working towards that!

GIS Programming folders in student drive created by running a provided script through PythonWin editor. 

No comments:

Post a Comment