Posts

Working with rasters

Image
 This week was learned how to work with rasters in Python. Our assignment was to write a script that created a raster that identifies areas where the landcover, slope, and aspect meet specific parameters. I began writing this script by importing the arcpy spatial analyst module and all of the functions. Next,  I began an if statement that contained the majority of my script. It begins with a conditional statement and notifies the user if the spatial analyst module is available. If it is not, then the else statement tells the user that the license is not available.  The if statement checks the spatial analyst module out and in. Next, it reclassifies the land cover. Then, it calculates the desired slope and aspect. It then combined all of these rasters into one final raster and saves it as a tif file.  The final output is included below.

GIS Programming- Working with geometery

Image
 This week we learned how to work with geometries. Our assignment asked us to create a new .txt file and populate it with data from a shapefile. We were to include the object ID, the X and Y coordinates, and its name. I used a search cursor and nested for loop to accomplish this task. The trickiest part was making the .getPart() function to work. I kept receiving errors stating it could not be retrieved. I was able to solve this issue by moving the fields around in the search cursor's tuple.   I have included the script's output and flowchart below.

GIS Programming- Exploring and Manipulating Data

Image
 This week we learned about exploring and manipulating data in ArcGIS Pro with Python scripting. We learned about a variety of tools and methods, such as describe, exist, listing, dictionaries, and cursors. In the assignment, we were given a variety of tasks. First, we were to create a new file geodatabase. Next, we were to list all of the feature classes in another folder. We then copied those feature classes into the new file geodatabase. Using one of the files in the new geodatabase, we used the search cursor to identify the objects that matched specific criteria and printed that information. Finally, we created a dictionary with this information.  I encountered issues with populating the empty dictionary. I was attempting to use the row.getvalue method,  I kept receiving the error that my tuple did contain the attribute. I began my troubleshooting by searching for various methods to update dictionaries. From there I edited small things in my script, such as the input ...

GIS Programming- Geoprocessing

Image
 This week we learned how to complete geoprocessing tasks with python scripts and models. The goal was to create a model in ArcGIS Pro and a python script. The script was to create XY coordinates in a shapefile, then create a 1000 meter buffer around it, and finally dissolve the buffer into a shapefile. I began this script by establishing my module and environments. I imported the arcpy module and my environment. I based this on previous template scripts. I then established my workspace and shapefile. Next, I created the XY coordinate script. I added the AddXY function and instructed it to print a message when done.  To create the buffer, I used the buffer analysis function and established my parameters. I set my buffer to 500 meters so the diameter would be 1000 meters.  To create the dissolve buffer script, I used the dissolve function with my input and output.  Finally, I inserted two print messages after each function. The first message informs the user what...

GIS Programming- Handling errors and debugging

Image
 This week we learned how to handle errors and debugging script in Python. The goal of this module was to learn how to deal with syntax errors and exceptions, manually debug, and use debugging tools. In the assignment, we were given 3 template scripts with errors. In the first two, we fixed the errors to allow the code to run correctly. Below are the final outputs and flowcharts for these scripts.  Script 1: The goal was to name the fields in a shapefile.             Script 2: The goal was to print the spatial reference of the project and then list the layers in the project.  In the final script (script 3), we were to ignore the errors and use a try-except statement to allow the script to run and produce an error message. As seen in section A's output, there is an error with the 'aprx_path' missing an argument. The try-except statement identifies this error and prints a message for the user. Part B is meant to provide the name, data source, a...

Intro to GIS Programming

Image
 This week the GIS programming course began. The objective for this week was to learn the fundamentals of Python coding. We were tasked with creating codes that include strings, lists, and while and for loops. The results of my code are below. It includes steps 1 through 4. Also included below, my workflows demonstrate my codes and process. Workflows: I have included my workflows for steps 1 through 4. Creating step 1 was easy because it utilized strings, lists, and the split function. In step 2, we were told to fix two errors. One of which was a lack of quotation marks around the print (p + "rolls a" + "dice" + "out of" str(x*2)). In step 3 we were instructed to create a while loop that created 20 random numbers that ranged from 0 to 10. I used the random integer function to create the random numbers, x was the counter variable, and my if and break statement stopped at 20. Looking at step 4 in more detail, I created a code that removed an unlucky variable...

3D Mapping

Image
 This was my final module of Computer Cartography. We learned about the future of GIS and 3D mapping techniques. We were assigned to create a map of Florida in Google Earth Pro. The map includes a shapefile with the surface bodies of water, dots representing population density, and county boundaries. The majority of the files were provided as-is to us, but we were asked to properly symbolize the bodies of water and convert the file to a KML file in ArcGIS Pro. I simply inserted the other map elements into google maps to create this current layout.