Skip to main content

Posts

Showing posts from June, 2021

Working with Rasters

 In this last lab assignment for GIS Programming, I learned how to work with rasters using the arcpy.sa (Spatial Analysis) module. Our goal was to create a single raster image that met the following goals through the original dataset:  Forest landcover (classifications 41, 42, and 43)  Slope between 5° and 20° • Aspect between 150° and 270° To achieve these goals, I created five temporary rasters files and then combined them into one raster layer. I came across a couple of issues while creating my script for this assignment.  The first issue I came across was I had 1,2,3 as the second number component in the RemapValue statement. I had missed the part in the script template that stated to assign all the new values to 1. My second major issue was also caused by skipping a line. I did not add the line to create the elevation raster. This gave me some very interesting issues. While the script ran through all the way, whenever I tried to map my final raster file I got 12 categories rathe

Working with Geometries

 This week I learned about working with geometries in Arcpy; how to read, write, and work with multipart features. We began by setting our workspace and utilizing a cursor in order to create a new txt file, and write data into it from the rivers.shp. Below is a short summary of the steps I took:  Import arcpy from arcpy import env set workspace set overwrite set outpath define variable for river.shp create txt (rivers_ESG.txt) create search cursor set variables for OID, NAME, and vID to be able to call upon them set first for loop in cursor vID + = 1 set second loop in row[1] set third for point in part print OID, vID, coordinates x,y, NAME output.write (same as above) to add to text file I encountered one main issue, and that was how to print everything.  Looking back at the past lessons, I saw that I had to call upon the .format( ). However,  this function did not work for printing the names. After connecting with my peers, they suggested using simply row[2].  This worked but did not

Exploring and Manipulating Data

 This week was the most challenging lab yet. I created a script from scratch to create a new file geodatabase, copy feature classes into it that met a SQL criteria, create a dictionary, and lastly list the keys and values of the said features classes into the dictionary.  Below is a flow map of my script. Two struggles I had: 1          My first struggle was to print the list of copied files and print times. I couldn’t figure out what was wrong in my statement, as it ran but did not print. One of my peers mentioned that it’s because when using row.GetValue(), it can register the item as an integer and not print. I then cast a string str(row.GetValue()) and resolved my issue. 2          My second biggest issue was determining how to place the statement to add the key and values to the dictionary. <dictionary variable>[<key>]=<value> I added the statement inside my for loop, after defining key and value. Also at the suggestion of a peer, I removed the <> and the

Geoprocessing

 This week we learned geoprocessing in ArcGIS Pro via the Modelbuilder and Python.  First, I built a model in the ModelBuilder. My goal:   Clips all soils to the extent of the basin   Selects all soils that are classified as "Not prime farmland" under the [FARMLNDCL] attribute  Erases the "Not prime farmland" soil selection from the basin polygon  First, I utilized the Clip tool to remove the Soil areas (input feature) from the Basin area (clip feature). [I think of the layers of the cookie dough sheet (clip feature) vs the cookie cutter (input feature).] Second, I used the clipped data from step one to Select only the areas classified as ‘Not prime farmland,” utilizing the query Where FARMLNDCL is equal too ‘Not prime farmland.’ Here the attribute ‘Not prime farmland’ comes from the clipped clipped soil layer. Lastly, I used the erased the selected data (Erase feature) from step 2 from the original soil shapefile (input feature). The second part of the lab, I u