Showing posts with label GIS5103. Show all posts
Showing posts with label GIS5103. Show all posts

Friday, August 4, 2017

GIS Programming (GIS5103): Module 11


In this week's module, we learned how to share tools that we created for ArcMap. The first way of sharing an ArcPy script tool is compressed the original folder that houses the script into a .zip file. The second way is putting the tool files on the local network (this is only relative if you are on shared network environment). The third way is to publish the toolbox as a geoprocessing service which can be publically assessable to anyone on the Internet.  We also learned how to embedded our scripts into the script. By embedding the script into the script tool, you can share the toolbox file instead of a .zip file which has three different files or more. Another benefit of embedding the script is that you can place a password on the script to prevent people from editing or viewing the script.

Some of the highlights of what I learned this semester:


1.       I think the interesting thing I learned in this class was in Module 9. I thought that using the Python script to find areas that had certain characteristics by using parameters, such as, slope, aspect, and landcover type was a great way to cut the time of finding each of these characteristics. It was kind of fun having a script that able to perform multiple functions.

2.       The most useful thing that I learned was making sure that the line of code was in the right location in the script because certain lines of code should not be placed in the for loop. I found this out when I was working on Module 8’s script; I was trying to print each point’s Feature OID, Vertex ID, X coordinate, Y coordinate, and the name of the river feature.

Wednesday, July 26, 2017

GIS Programming (GIS5103): Module 10


In this week's module, we learned aspects of creating a script tool for ArcGIS and how to modify the script to fit the need of the project's tool. We created a toolbox to house the newly created script tool. The parameters were set using the Parameter Tab in the Properties window so that the imported script will function in ArcMap. After setting the parameters in ArcMap, the script had to be modified in PythonWin. The parameters' variables had to be changed to from specifically located files to open input. The arcpy.GetParameter() function was applied to parameters' variables. Along with the changing the variables, the print statements had to be replaced with arcpy.AddMessage() statements so that ArcMap can print the messages in the Results tab.

GIS Programming (GIS5103): Peer Review Article #2



Peer Review Article #2

Python based GIS tools for landscape genetics: visualising genetic relatedness and measuring landscape connectivity

Author: Thomas R. Etherington

URL Link: http://onlinelibrary.wiley.com.ezproxy.lib.uwf.edu/doi/10.1111/j.2041-210X.2010.00048.x/full

            This article discusses using GIS and Python for landscape genetics research which will help researchers gain a better understanding of spatial ecological processes. Using GIS is vital to this particular area of research; however, there is a degree of customization that is needed to processes the data which often beyond the non-specialist (Etherington, 2011). To remedy this issue, Python was used to create a series of script based GIS tools that were specifically designed for landscape genetic studies uses. These scripts allow the user to convert the files, visualize genetic relatedness, and quantify the landscape connectivity using the least-cost path analysis (Etherington, 2011). The scripts are stored in the ArcToolbox that allows free accessibility to them along with the Python code that created the tools. By creating these Python scripts, researchers are able to fully utilize the current software; the user community can also provide farther enhancements to the scripts, and this will cut down on the time spent on developing common solutions (Etherington, 2011)

            Etherington was able to elaborate how he implemented GIS and Python to his own research very well. Even though the article was quite short, it was packed with useful information on how Python can customize tools for GIS. I found this article to be very interesting because the GIS tools that Etherington created for landscape genetics can allows be applied to the movement of past and current infectious and contagious diseases in different parts of the world.

Etherington, T. R. (2011). Python based GIS tools for landscape genetics: visualising genetic relatedness and measuring landscape connectivity. Methods in Ecology and Evolution, 52-55.

Monday, July 24, 2017

GIS Programming (GIS5103): Module 9

In this week's module, we learned how to create raster output using Python and we also learned how to identify areas with a particular set of slope, aspect and landcover type parameters. The ideal areas' traits were forest landcover with classification of 41, 42, and 43, slope between 5-20 degrees, and aspect between 150-270 degrees. This assignment was not too difficult to complete this week. The only little hiccup I had when creating the script was accidentally putting the beginning of the if statement as 'if arcpy.CheckOutExtension...' instead of 'if arcpy.CheckExtension...'. This mistake was easily cleared up and the script worked like a charm.

Wednesday, July 19, 2017

GIS Programming (GIS5103): Module 8

In this week's module, we had to create a .txt file and using Python script to write into the file. The information that was being written into the file was the point data for all vertices. Each point had to have the Feature OID, Vertex ID, X coordinate, Y coordinate, and the name of the river feature. Writing this script was another challenging one to work on. I had one line of code misplaced in the for loop which allow wrote one line of information in the .txt file. The line of code I had to move was the "output = open("rivers_TScranton.txt","w")". I moved this line of code outside of the for loop and the script worked like a charm.

Wednesday, July 12, 2017

GIS Programming (GIS5103): Module 7


In this week's module, we had to create a new geodatabase, copy all of the data from the Data folder into the new geodatabase, and populate a dictionary with the names and population of every 'County Seat' city in New Mexico. I ran into some issues when trying create this script. I had to use a delimitedField function to be able to use the Search Cursor and populate the dictionary. This script was quite the challenge in completing this week since my knowledge on Programming is still at a beginners' level. 

Thursday, June 22, 2017

GIS Programming (GIS5103): Module 6

In this week's module, we learned how to Python to execute geoprocessing tools in ArcMap. We had to create a script that performed 3 different geoprocessing functions: adding a xy coordinate, creating a buffer, and dissolving the buffer around the hospitals into individual features. This assignment was relatively easy to complete and I only had a little trouble getting the Dissolve tool to work.

Monday, June 19, 2017

GIS Programming (GIS5103): Module 5


In this week's module, we learned about various geoprocessing tools through Python. The screenshot above shows the basin without the 'Not prime farmland' shapefile aka soil_Select.shp thus resulting in areas that are prime farmland in the basin. Overall, this module wasn't very difficult to complete and it was quite helpful with how to the batching aspect of geoprocessing tools. 

Notes:



1.       Right-click the newly created toolbox and add ‘New Model’. Drag the needed shapefiles into the ModelBuilder.
2.       Drag the Clip tool, Select tool, and Erase tool from the ArcToolbox into ModelBuilder.


Wednesday, June 14, 2017

GIS Programming (GIS5103): Module 4



In this week's module, we learned how to about debugging and error handling the scripts. Script 1 was quite easy to fix since we were only fixing two exceptions. Script 2 was a little bit tricky when I got the df.pantoextent part, I was able to fix the error by using the defined syntax of extent into the parentheses next to the df.pantoextent. Script 3 was took a little bit more time to do since we had to apply the try-expect statement to the script. Pages 242-243 were somewhat help with getting the general idea of the placement of the try-except statement should be located within the script. 

Notes:


1.      Delete the ‘mapdoc.save(),’ ‘del mapdoc,’ and lyrlist scripts so that the try-except statement can run correctly.
2.      Make sure to indent the if statement after the for statement because an syntax error will show saying ‘expected an indented block’
 

Sunday, June 11, 2017

Peer Review Assignment #1




Geoprocessing tool to model beach erosion due to storms: application to Faro beach (Portugal). 

By: ALMEIDA, L.P., FERREIRA, Ó. And TABORDA, R.


URL: https://hostsited2l.uwf.edu/content/enforced/998343-50402GIS5103201705/SupplementalReadings/PotentialsForPeerReview/Almeida_et_al_2011.pdf?_&d2lSessionVal=toxLBNl0eaL1nMS7E8yhUvnlj&ou=998343


This article discusses the application of GIS programming on creating a geoprocessing tool called GEOSTORM which models beach erosions caused by coastal storms. GEOSTORM was applied to a case study onto Faro Beach, Portugal. The tool cuts down on the amount of processes taken to get a model representation of the beach erosion. GEOSTORM is comprised of two modules that are connected to graphical user interface (GUI).


The first module of this geoprocessing tool is preparation of transect. This module allow the users to create a group of cross-shore transects with uniform lateral spacing along the coastal area of interest. The inputs that are needed before using the Module 1 are a digital terrain model (DTM) and a baseline shapefile. Python was used to create this module by using the scripts as executable files which can be brought forth from the VBA code when the GUI pushbutton objects are acted upon. The by-product of this module are XYZ coordinates for each transect (Almeida et al. 2011:1831). 


The second module uses this XYZ coordinates to give a profile erosion estimation of each transect by applying the Kriebel and Dean storm erosion convolution model. The by-products of this module are the retreat line and the eroded volume. Kriebel and Dean model allows the determination of maximum retreat and eroded volume for four types of schematic beach profiles (Almeida et al. 2011:1831). Another programming software was used to help connect Module 1 to Module 2 and this software is called Matlab GUI. Matlab GUI was used as a boundary line between Kriebel and Dean model and the user. The beach profiles that were created by Module 1 are utilized by the Matlab GUI.  This data is utilized by the user to set the hydrodynamic conditions. Once the conditions are set, the simulation will start but the user has to continuously input some morphological parameters to help define the profile type. The final results of the second module are converted into ASCII files which are then converted into a shapefile using Python and finally imported to ArcMap using VBA (Almeida et al. 2011:1831-1832).


GEOSTORM was applied to the case study area of Faro Beach, Portugal using a storm with a 25 year wave characteristics return period in the application. The results of GEOSTORM show that there is not enough protection from erosion due to predicted output of the beach coastline morphology. The lack of protection means that the storm’s erosion impact will affect areas where humans occupy such as houses, roads, parking and seawalls (Almeida et al. 2011:1832-1834). 


Overall this article was very straight to the point on how this new geoprocessing tool can be used for real life issues many coastal communities face after a storm passes through thus causing the coastline to eroded. The article was well written and was easily understandable for a person who just began learn about GIS and applications of programming. The only weakness that was found in this article was that it did not elaborate enough about Matlab which I would have like to learn more about.



L.P. Almeida, Ó. F. (2011). Geoprocessing tool to model beach erosion due to storms: application to. Journal of Coastal Research, 1830-1834.