Friday, June 19, 2015

Module 5 - Toolboxes and ModelBuilder

In GISProgramming this week we took a look ModelBulder in ArcGIS and touched on exporting Python scripts for editing in PythonWin. Every week I find this class more and more useful and I find myself eager to look at the topics for the next week. Next week is more of the Python scripting side of ArcGIS rather than ModelBuilder so it should be interesting. Now on to the highlights from this week.


Farmland within flood basin boundaries
The purple polygons in the graphic above are the result of the model and script I created this week. As a bunch of purple polygons it may not look like much but if you had seen it at the beginning it would have looked like a bunch of colors, squiggly lines, and overlapping polygons depicting flood basins and soil composition for an area. Now the graphic only shows prime farmland within a specific basin. The model I created clip the soil file to the much smaller size of the basin file. From the clipped soil layer the areas listed as "Not Prime Farmland" were selected. This selection was erased from the basin layer leaving only areas suitable for farming in the basin visible in the final layer. The model used three tools and two original variables to create the final layer and was much easier to work with than trying to run each tool individually.

After verifying the model ran correctly I exported the model from ModelBuilder to a Python Script. I opened the script in PythonWin and added some minor edits to make sure the script would run outside of the Python Window in ArcGIS. The two major obstacles here were making sure the filepaths for the original data were correct and allowing the script to overwrite existing files. The filepath changes were simple but in order to overwrite files I had to add a line of code to change the environment settings that would normally be done in the Geoprocessing Menu in ArcGIS. Once the script was corrected zipped it with the Toolbox I created for the model I built and it was ready to share. (Really it was ready to submit for a grade - but that is still shareable.)

1 comment:

  1. Casinos in Las Vegas Near Casino - JMH Hub
    The 부산광역 출장마사지 Casinos in Las Vegas Near 인천광역 출장샵 Casino. JRM 군산 출장마사지 has partnered with the City of Luxury 전주 출장샵 to offer you the 정읍 출장샵 best experience in Las Vegas!

    ReplyDelete