Posts

Showing posts with the label GIS5103

GIS 5103 Module 6 - Working with Geometeries

Image
For module 6, we learned how to work with search cursors to pull geometric information from a shapefile. This required the creation of nested for loops, however this wasn't without issues due to the instruction to close the file and cursor. This required moving on from for loops to using a try/ finally construction rather than the code as demonstrated in the textbook which used a with along with the nested for loops, the with architecture automatically closes the cursor & file when all the for loop criteria have been met.   Overall, this week's exercise seemed easier than that of the previous week, perhaps because I was already familiar with the tuple call which gave me some difficulty in module 5.

GIS 5103 Module 5 - Explore & Manipulate Data

Image
For this week we had to work with creating a new fGDB and then listing the feature classes to be copied to the new geodatabase using Python, each shapefile is then copied to the geodatabase  After iterating through each geodatabase a search cursor is initiated in order to produce the county seats within the cities shapefile along with their population Finally, a new dictionary called county seats is created and each of the county seats and their population is fed into the new dictionary and the new dictionary is printed

GIS 5103 Lab 3 - DeBugging

Image
  For this week's lab we were asked to de-bug 3 separate instances of python scripts. For the first script we were asked to work through the code to debug it, the majority of the errors within this code chunk were simple punctuation and capitalization errors The second script was much the same, though errors were more complicated and included issues like an incorrect file path. For the third script, we were asked not to fix the code, but in fact to insert a Try-Except process to allow the code to run without fixing the error. For me, this entailed inserting the try function above code line 13 and then catching the exception after approximately 8 lines My full process for working through the creation of the Try-Except loop can be seen below Python 3.11.10 (main, Sep 20 2024, 18:44:55) [MSC v.1938 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license()" for more information. ========= RESTART: S:/GISProgramming/Module3/Result...

GIS 5103 Lab 2 - getting started in Python

Image
  For this week's exercise we were asked to  use a string to create a list from which the last name could be extracted, we were asked to debug some code to generate a dice game and we were asked to create a random list of twenty numbers between 0 and ten and then create an if else while loop that would allow for the counting of the instance of the numbers Assignment steps, Step 4: Create a loop that removes a chosen integer from the list previously generated This step involves creating a while loop and the remove() method to remove the chosen integer from the previously created list. Give a detailed explanation of how you completed this step. To start with, I created a variable, unlucky, and asked for user input: “Enter an unlucky number between 0 and 10 to remove from the list.” Then I created an if-else statement where if the chosen unlucky number was not in the luckyList, it would print “The unlucky number X is not in the list” Otherwise, it will print removing Y instance...