Wednesday, August 9, 2017

GISProgramming Module 11 Sharing Tools

In this week's lesson we learned how to use Arc Catalog to create help files and add properties and data notes to files to share. We created our own random buffer tool that had open path files, meaning that when you open the tool in your map you input your own parameters and file paths and you don't need the creators data to use the tool. We set a password and imported our script to the tool we made and used sys.argv[] in our code to correspond to all the parameters in our tool dialog box, like buffer distance or output file path.

This was interesting, and I can see with passwords how I am locked out of looking at system tools but I was able to get into other tools from class and see how the parameters were set up with a string, long, or double and so on.

I kept hitting an error message with my 2nd parameter for the number of sample sites, I tried the tool with the value 50 like in the lab but also with 5 just for fun and got an error saying "the value 50 (or 5) doesn't exist", I asked for ideas on the class discussion page with no replies, and I looked at ESRI help and Stack Exchange help pages trying to figure out this error, I even changed the order of my index numbers in the sys.argv[index number] script just to see if that had any effect, but it did not. My tool hits this error and doesn't finish running because of this. I re-created the tool from scratch about 4 times to check to make sure I followed the lab, and same result. Below is my error:

Wednesday, August 2, 2017

GIS Programming Module 10

In this week's module we are working with using Python scripts to create our own custom tools. We are setting up toolboxes, adding scripts, setting parameters for inputs and outputs to run the tool and error handling and checking that the tool works in ArcMap.

Below is a screen shot of the clip tool that I created:

I re-did the code to fix a filepath error, add an error message, added a string, and set index parameters. When I run the tool I get an error saying that FC is not defined, before I had an error saying it was a nonetype. Below are my results:

From the class template the changes I made were following the lab and I added an error message to weed out my "none type" error, as shown below: I got the idea from stack exchange and it did help, but I still had an error with "FC" in the line of code.

Here is my script tool with the various inputs filled out:

Creating tools is very interesting and useful, but you have to be very careful with the code for it to work!

Wednesday, July 26, 2017

Applications in GIS Module 8 Damage Assessment

 This week we read several articles about damage assessments done after tsunamis and hurricanes that used remote sensing or GIS to look at the factors like buildings, water height, vegetation and more to study why the damage was severe in areas or less in others and how to calculate and quantify losses or look at prevention in the future.
Then, we looked at creating our own damage assessment starting with a map of hurricane Sandy in the USA.  We created a damage assessment table and used editor to make points and add noted to the points about the damage to the buildings they marked.

  I added a buffer at 100, 200, and 300 meters from the coast line and used select by attribute and made a new layer from selection for each  level of damage to get counts for damage by building type from just the points I created.

  The most interesting parts were learning to create our own hurricane symbols, label with vbScript, and how to create a join of sorts by matching records using the attribute transfer tool. I found these the most interesting because it is often these little details that add polish and accuracy to map making and I can see using them often, and I wish I had learned them sooner!

Here is my working ArcMap screen image of the NJ area with the vb scripts labels and all of my structure damage points are shown as house symbols with each color showing either residential, industrial, government, or other and the raster imagery as a base layer.

My next map shows the path of hurricane Sandy along the east coast with the FEMA states and the custom symbology for types of storm along with the wind speed and such labeled, also using vbScript as per the lab.

My last image shows my multiple ring buffer with the colored dots (level of damage) inside the house (structure type) symbols, this made it easy to see my edits visually.

Monday, July 24, 2017

5103 GISProgramming Module 9 Rasters

This week we are working with rasters in Python, using describe and spatial analyst to access information in and make changes to raster type files. We worked with reclass and map algebra functions and using Boolean logic to combine rasters and save with the save method. Below is my raster from the exercise.

Here is the raster from the lab assignment:

Here is the results window while working on the lab in ArcMap:

Here is the raster and after running the slope and aspect code to set parameters:

Monday, July 17, 2017

GIS Programming 5103 Using Geometries

This week we worked on using vector based geometries in Python. We worked with creating new shapefiles and with creating text files. The use of array was interesting, because when you have lots of data, this is a great way to retireive it all with short code.
Using insert and search cursors was good practice as was running through a loop.
I used the book and lab exercise to piece together code, I feel like I had maybe too much code and some was redundant, but  I didn't want to leave a line out that might cause the workspace to not be set or the right module to be imported.

I had to step through the debugger a lot! I tried to follow the book example but adapted for a polyline since I was dealing with a river shapefile. I think some of the text on multipart is probably best for a rivers file, but I wasn't sure how to apply that to writing a text file from an existing shapefile since the lab and book focus on making a new shapefile from an existing text file, so doing this in reverse was a bit overwhelming.

I think I got all the steps the template asks for when I created my scripts, like I said, I may have too much code or could clean it up if I knew what was essential and not. I had errors with the line split that caused the last part to not run. Here is the text file that is created: