Posts

Showing posts with the label GIS5103

Module 6 GIS Programming: Working with Geometries

Image
 Hello all, in the final week of GIS Programming we learned how to work with geometric data from ArcGIS in Python. This included each level of geometric data, from features and arrays down to just point and coordinate data. We also practiced writing data to a text file and using the nested for loops to reach different levels of data. The getPart method was used in particular to skip a loop and retrieve the coordinate data for the rivers.  I've included a small text file section where I printed the OID, vertex ID, x,y coordinates, and the feature's name (from left to right).      The assignment was very logical and did not create too many problems for me. I need to remember to close the text file at the end so that the processes will actually occur and write to the text file. I've included a flowchart of the logic of my script below: Thank you,     Joel Sexson

Module 5 GIS Programming: Explore and Manipulate Data

Image
 Hello all, in the 5th week of GIS Programming we learned how to deal with data. As the title of the module states, we explored data using things like describe functions and search cursors, and we manipulated data by learning about insert/update cursors and how to create different data (such as creating a file geodatabase or a dictionary).      The assignment was to create a script that made a new file geodatabase, copied over feature classes from one folder to the geodatabase, and then populated a dictionary using data from a search cursor done on the cities layer in the fGDB.      Below is a picture of the flowchart of my script:       The results of the script are shown above. There are print statements throughout the script to explain what processes were happening and when they were completed. The only problem that I ran into with the script actually helped me learn how to determine if my script is working the way I want it to i...

Module 4 GIS Programming: Geoprocessing

Image
        Hello all, the fourth week of GIS Programming (4102/5103) was an introduction to running geoprocessing tools using ModelBuilder in ArcGIS and a main focus on using Python scripts to run geoprocesses. The first thing to learn about using Python for GIS is to import arcpy and set your workspace to begin the code. Some main things to watch out for when using GIS tools in Python are things such as allowing outputs to be overwritten, using the correct syntax for the tools, making sure data exists, and assigning features to variables in the script. These can allow for the scripts to run smoother and without errors.      The first part of this assignment included using the Clip, Select, and Erase tools in ArcGIS using a ModelBuilder. The logic of the model was relatively simple and could erase the selected soil areas that were not prime for farming.      The second part of the assignment asked for the use of the AddXY, Buffer,...

Module 3 GIS Programming: Debugging and Error Handling

Image
     Hello all, the third week of GIS Programming (4102/5103) was to teach us how to debug code and handle errors within the code. The first main way to find errors in code is to check the module first to check for syntax errors. If a syntax error occurs, none of the code will even run because Python can not understand what was written. After finding potential syntax errors, runtime errors could be identified either by running the code to see the error message or by running a debug tool. I personally find it easier to run the code and see the error message but I understand that at times a debug tool would be very useful. We also learned of another way of handling errors to allow the script to run without necessarily fixing the problem. A try-except statement can capture an exception (or error) and allow the script to keep running without that part of the script. You can also use it to print the error that occurred, which can be helpful in fixing the error.    ...

Module 2 GIS Programming: Python Fundamentals

Image
      Hello all, the second week of GIS Programming (4102/5103) was focused on learning the fundamentals of Python. This included topics such as loops, formatting, lists, sets, and many other basic functions/methods used in Python scripting. As I've said before, the Zandbergen (2020) book helped a lot with figuring out how to do a lot of this. This week we were tasked first with creating a set of names and splitting it into a list. This was simple enough and was a good introduction to creating and indexing a list. The harder parts of the assignment were correcting the dice code and creating a randomly generated list using a while loop.  I've provided my results from the code down below:     The dice code had two errors, which took me longer than I expected to figure out. The first error was a syntax mistake in a print code that needed to be cast. The second error was simply a capitalized X instead of a lowercase x. I have included a flowchart of the logic b...

Module 1 GIS Programming: Python Environments and Flowcharts

Image
       Hello all, the first week of the Summer 2023 GIS Programming course (GIS4102/5103) at UWF was an introduction to basic Python, including its environments and some syntax, as well as the logic, principles, and design of flowcharts. Since I've had no prior coding experience, the first week was very daunting. However, taking my time to do some extra practice outside of the exercises and readings really helped quell those fears and prepare me for the work. I cannot recommend the   www.w3schools.com/python/   tutorial enough for beginners to understand Python. It is interactive, explanatory, and has exercises built in. I would also like to make note of the  Agarwal et. Al. (2010) reading for a good introduction to flowcharts, which helped me to create mine.      Module 1 introduced us to Python environments with a main focus on IDLE and ArcGIS Notebooks (integrated Jupyter Notebooks in ArcGIS). IDLE and ArcGIS are the same in that they...