Sunday, June 27, 2021

 GIS Programming Module 6

This week we learned about manipulating rasters with scripting. We experimented with listing rasters, working with raster objects, using map algebra in operators and we worked with classes to define raster tool parameters. 

The main objective of this Module was to create a raster with a given set of parameters. The raster had to have a slope, aspect and land cover of a certain type. 

Below is a flowchart that I came up with that goes through the steps I came up with to accomplish the objectives of the assignment. 


The final raster is a combination of 5 distinct variables that were put together to come up with a single raster that contains land cover with a slope between 5 and 20 degrees and an aspect between 150 and 270 degrees. Below is a screenshot from ArcPro with my final raster. 

.
This assignment required the use of many variables and a good amount of coding. When so much is going on it is a good idea to go through and ensure that all variables are referenced correctly and that working environments are set appropriately. 




Sunday, June 20, 2021

 GIS Programming Module 5

This week we have been working on Module 5. In Module 5 we learned to work with various scripts to help interpret geometries. In the exercises for this week we practiced identifying certain portions of geometries and working with text files to write geometries. 

For this module's assignment we had to write a script that will create an empty text file and then we had to write a series of for loops to iterate through a given shapefile and identify the XY coordinates of multipart shapes. Once the loop went through and identified the X,Y coordinates the script had to then write the data to the text file in a clean and coordinated fashion. Below is a flowchart I put together to go over the steps of my script. 


Below is a screenshot of the resulting text file. 





The resulting text file was populated with the feature ID, Vertex ID, X, Y coordinates and the name of the feature. In this case the features are rivers on the island of Maui Hawaii. 

This assignment took some effort as there was lots of looping involved to get the final results. Some trial and error led me to understand how critical indentions are to make sure what needs to be in a loop stays in a loop. 






Sunday, June 13, 2021

 GIS Programming Module 4

This week's covered exploring and manipulating data using Python. 

The first part of this Module's assignment was to write a script that will create a file geodatabase and populate the geodatabase with data that was provided. 

Once the file geodatabase was created and populated we used that for the second part of our assignment. Using a shapefile in the database we had to use a search cursor to filter out cities in New Mexico which are County Seats. The search cursor produced a list of County Seats along with the attribute feature type and the individual cities population. 

Using the same data as was printed from the search cursor we created a second search cursor which populated an empty dictionary that we created. Once dictionary keys and values were assigned the dictionary had to be printed out. 

There were lots of steps and lots of printing going on in this script so we had to make sure and use arcpy messages and print statement that we created to delineate and explain what was going on at any given time in the process. 

Below is a flowchart outlining the script that I created for this assignment. 


The results of the script I wrote:

Creating and populating a new file geodatabase.






Results from search cursor. 

 


Final populated dictionary showing key and values City Names : Population.


The assignment for this module was fairly challenging. We had to write a long script with multiple operations. The length and complexity of the script allowed for the possibility of many errors. Thankfully the script could be broken up into smaller sections and tested individually. One issue is that with some many trial runs to test the script I had to constantly deal with locks on files. A small issues yet one that took up some time to correct. 












Sunday, June 6, 2021

 GIS Programming Module 3

In module 3 we carried out various operations by using models and scripting in ArcPro. In the practice exercises for this Module we carried out simple geoprocessing functions and practiced geoprocessing in batches. The assignment for this Module was split into two parts. The first part had to do with the creating a model that would Clip, Select and Erase data from two provided shapefiles. The process was fairly straightforward. Below is the resulting data that was produced in the model. The data shown represents soils within a basin area with areas that were not classified as Prime Farm lands excluded.  

The second part of the assignment this week was to write a script in an IDE that will complete the following tasks:
1. Add XY coordinates to a shapefile containing hospital locations as point features. 
2. Create a 1000 meter buffer around hospitals points. 
3. Dissolve the edges of the created buffer. 

In order to orient myself and ensure that I included everything I needed in the script I created the following flowchart. 



After writing the script I achieved the results below. 


The script I wrote ran successfully. I checked the destination folder to ensure everything was there and I opened a new ArcPro project in order to visualize the results. 


The shapefiles represented above show the created buffer with dissolved edges along with the original hospital point locations. In the screenshot above you can see the data table for the hospital points shapefile with the added XY coordinate fields. 

Overall I thought this assignment will be very helpful for future tasks that I have to perform in ArcPro. As we learned in previous modules small details such as correct file paths and spelling have a great impact on how your code works. One of the most important parts of this assignment for me was ensuring that I added a line of script to allow for the overwriting of results. Allowing the overwriting of results allowed me to test and try new things when writing the code without running into the issue of having different files with the same name which would cause an error. 










GIS 6005 Communicating GIS Final I have reached the final assignment of this course. This week we had to put all the skills that we learned ...