Skip to main content

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: 

  1. Import arcpy
  2. from arcpy import env
    1. set workspace
    2. set overwrite
    3. set outpath
  3. define variable for river.shp
  4. create txt (rivers_ESG.txt)
  5. create search cursor
  6. set variables for OID, NAME, and vID to be able to call upon them
  7. set first for loop in cursor
    1. vID + = 1
    2. set second loop in row[1]
      1. set third for point in part
        1. print OID, vID, coordinates x,y, NAME
        2. 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 make sense to me until they explained that it represeted the field 2 in the search cursor! Genius! :) 

Below are the script outputs for the final script and a snip of the newly created txt file. 










Comments

Popular posts from this blog

Utilizing ERDAS Imagine to Analyze Map Features

 This week we learned how to utilize histograms and different bands to highlight different features in a map. On the following map that we worked on, dark bodies of water caused high peaks on the left of histograms while snow-peaked mountains were small blips on the far right. These simple distinctions help to quickly identify map features on a graph, that you can then utilize as a stepping stone to finding them on the image. I found it incredibly interesting how the different band layers highlighted different features on the map. Figure 1 below depicts three different features we found on the image.  Figure 1: Distinct features found on an image using ERDAS Imagine. Feature 1: Large body of water. Feature 2: Snow-capped mountains transitioning to thick vegetation. Feature 3: Shallow turbulent body of water near urbanized land, transitioning to deep calm body of water. 

Positional Accuracy: NSSDA

 In this analysis, I compared the street and road intersect data collected for Alburquerque, NM by the City of Alburquerque and the application StreetMaps. I used an orthophoto base layer as the reference for this analysis, to compare and determine the accuracy of both the City and Streetmap layers using NSSDA procedures. The most difficult part of this analysis for me was how to determine what 20% per quadrant looks like. Because the reference map was divided into 208 quadrants, I had to determine how to subdivide all the quadrant's equality into 20%. After multiple trials and error, I decided to subdivide the entire area (208 sub-quadrants) into 4 equal-area subsections. In this way, I could do 5 random right intersection points per subsection or 20% per subsection.  Map 1: City of Albuquerque city map data.  Map 2: City of Alburquerque SteetMap data When selecting a random intersection to place the points within each quadrant, I choose a location that had data f...

Scale Effect and Spatial Data Aggregation

 In this lab we first looked at how the scale at which we analyze data can affect geometric properties. Looking at data at three different scales (1:1200, 1:24000, 1:100000) I was surprised by my final calculations. I thought that there would be a lineal proportional relationship along the scales, but I did not find this. It makes sense that the greatest resolution [1:1200] would have the most detail of geometric properties, but I was surprised that 1:100000 had greater geometric properties than the medium resolution. I resampled the data using the Bilinear technique and found the following effect on DEM resolution.  As DEM resolution increases the average slope in degrees decreases. This makes sense because as you get closer, more in detail by getting closer, you are zooming in as actively seeing less features altogether.  In the last part of the lab, we looked into the Gerrymandering of districts in the USA. Gerrymandering essentially breaks up congressional distri...