Module 4 - Geoprocessing

This week, in the fourth GIS Programming lab, was about Geoprocessing. 

This lab had us utilize what we had learned from the last few lessons and write code on our own without a supplied script. The cumulative result is the the messages in ArcGIS Notebook you see below.

Now, allow me to now to explain through my process summary notes on how I was able to write this script and get these results.

For this lab, with concerns to designing my own script, was from utilizing what I had learned and what I could learn from the lab. To start I made sure I imported both my os and arcpy as I knew it would be important for checking the code in idle later despite running the code in notebook.

For adding the XY coordinates, I looked at the examples in the lab instructions from ESRI. I first set up my workspace and set it to my data folders as I knew it would be important for using my data. From there it was reading the code example on ESRI and implementing it how I thought it should be used in Notebook. I made sure to list hospitals as my in_data, and the xyfile, which we are copying, as the in_features. This then allowed me to copy the data into a new file and then addXY to my xyfile in the next step. Giving my hospitals XY coordinates.

Once adding the XY coordinates was done, I then needed to add a buffer to the points. I made my workspace again and looked at the example code in ESRI. From there I understood that my previously made xyfile would be my in_feature for the code, my out_feature_class would be the buffered xyfile and lastly list the distance I need the buffer to be, 1000 meters. So, once I had all of that, I made my analysis buffer with my in_feature, my out_feature_class, and my distance. Giving me my points a buffered layer around them.

Lastly, was to dissolve the borders of the buffers, so yet again I set up my workspace and looked at an example in ESRI. Once I had done that, I knew my in_feature would be my previously buffered data, and my out_feature_class would be my dissolved file. So, I set up the management dissolve code with my in_feature and my out_feature_class and got my correct data,

Once I had finished my code, I ran it a few times to make sure it worked correctly, and added get messages after each section was completed. I also went back and added print statements before each section was ran in order for it to have a correct timeline of events.

I then exported the file as a .py file and ran it in Idle to ensure that it still worked there just in case there may be an error. There was an error concerning duplicate files, but that was an easy work around in adding overwriteOutput = true. After evaluating the code a few more times it worked 100%.

Overall this was another great lab in learning python, as what we had learned was now put into practice. This lesson allowed for more experimentation with scripting and made us think more on what we needed to use to get out geoprocessing output. I cannot wait to see what the next lab has in store.

Comments

Popular posts from this blog

About me

Module 4 - Data Classification

Module 1 - Fundamentals