Posts

Showing posts from June, 2020

Module 7 - Rasters

Image
Due to a shortened semester, we were asked to only choose one of the two (2) modules left. I did chose Module 6 even though it was harder than I anticipated. But I wanted to challenge myself and I also didn't leave out Module 7 to learn more tricks in Python. This module was quite helpful as we didn't tackle much about raster data which I commonly am now working a lot in my job. As I'm working with a project related to catchment/watershed mapping, doing this module gave me more additional insights on Spatial Analyst tools. When using the Spatial Analyst module in Spyder, it is important to add the if-else statement in your script to check if the user is able to access the extension. Same goes to the check-in and check-out lines which I totally forgot and I spent 10-15 minutes figuring out why my code wasn't running. It's only returning an error saying that I don't have access to the extension. Anyways, got it all figured out when I went back and checked the ...

Module 6 - Geometries

Image
This is the hardest module as we had to go through nested loops which I definitely hate (to be honest haha). I had an issue at first on writing a file as I can't seem to find where the file was created. After that the nested loop got me banging my head at my laptop though again through the help of the comments template that was already filled in, I was able to extract my codes line per line. The trick here is to make it short and sweet when defining your codes and if you can concatenate them in one print or write statement then do that. It makes your code neat as well as it will be less confusing if you hit an error. Below is the screenshot of the results after I have ran the code. In addition, I also added a print statement in my code to show the same results as the text file and then another print statement at the end of the code. This helped me to not waste time cross-checking files and I can just check if it has ran successfully using the IPython terminal. Take it one ...

Module 5 - Explore & Manipulate Data

Image
This module was information overload and I had to like dig deep through my brain on our past modules. But it was rather exciting and awesome that I was able to finish this script. I really appreciate the comments a lot and the flowchart. That was the MOST HELPFUL part of this c lass as I was able to cut them into pieces and debug the codes accordingly per piece.  For the first 2 parts was easy, creating an fgdb and copying the shapefiles to the fgdb since it was straightforward done in the Exercise module. I had some difficulties with the iterating over cursor and dictionary. With the iterating over cursor, I was stuck in printing the POP_2000 values at it returns that it is an integer and not a string. So I did a lot of workaround and ended up even reducing my code lines. So I combined the print output instead of defining them then printing results. What I did then is to add format() for my row value so that it converts my integer value to string. Also, I wasn't so sure at fi...

Module 4 - Geoprocessing

Image
Geoprocessing is a an importent component in GIS. Whether you're a new or advanced user it is an essential set of tools you will use for processing geographic and related data. It offers to perform simple spatial analysis to complex ones. It can also be modeled into a sequence of spatial relationship that will help the user to automatize tasks from one tool to the other and produces a whole new dataset you can use for decision making. Another component related to geogprocessing is the Model Builder, which I recently have used quite frequently this year. In one of the projects that I'm working on we had to run multiple tools from the input until the end result. And we need to do that everyday, instead of running 10+ tools daily, why not create a model wherein all you need to do is add the input parameters (daily) and run it. It will then publish the end result in my ArcGIS Online profile and there you go I now have an updated dataset I can publish daily. Model Builder is lik...

Module 3 - Debug & Error Handling

Image
This week we focused on how to debug and handle errors. This was quite beneficial as this section was not taught to us way back in college. I think it's important to learn this on how we can proper debug and handle errors as we experience this a lot when coding - whether it's python or other programming language. Discussing this an an early stage will help us avoid mistakes or if we do have mistakes we know how to find and fix them. It is important to note that: Be aware of indentation especially when using try-except, if-else, for-while, etc. This is very crucial in your program code. The most common mistakes we have is we forget to be mindful of (1) punctuation (e.g. colons in after the statements mentioned above), (2) capitalization - make sure that you're using the right letter case when you define a variable and calling it out, (3) spelling It is essential to make use of Spyder's debugger tool that can help you review line by line on where you're exp...