Thursday, August 30, 2012

GIS 4930 Project 1 - Statistical Analysis with ArcGIS


For our first project of this new semester, we will be looking for information to help law enforcement determine potential hotspots for meth activities.

Or task this week was to create our Base Map of the Study Area, as well as generate outrIntroduction/Background information.   We also had to do a Process Summary and provide the results of that work. 

Here is my base map:


Here is Section 3 of my Process Summary:

Prepping the Census Data: Programming with Python
Include notes in this section about how and why to prepare your script in python.
1) Added the CensusTracts data to a new MXD
2) Opened the attribute table
3) Added field pcntPopGro as Float
4)  Used the field calculator to set this to (( [POP2010] - [POP2000]) / [POP2000]) * 100
5) Added field pcntWhite as float and used field calculator to set it to ( [WHITE] / ( [WHITE]+ [BLACK]+ [AMERI_ES]+ [ASIAN]+ [HAWN_PI] + [OTHER] + [MULT_RACE] + [HISPANIC])) * 100
6) Added field Roomates as float ans set to be( [HOUSEHOLDS] - [HSEHLD_1_M] - [HSEHLD_1_F] - [MARHH_CHD] - [MARHH_NO_C] - [MHH_CHILD] - [FHH_CHILD])
7) Next we opened up the AddCalcFieldsShell.py script in IDLE
8) Set my workspace to point to S:\GIS4930-GISSpecialTopics\Project1\Project1Data.gdb so the whole line is :   env.workspace = r'S:\GIS4930-GISSpecialTopics\Project1\Project1Data.gdb'
9) Prepared the last 5 lines as follows:
# pcnt40_49
arcpy.CalculateField_management(censusFC,"pcnt40_49","([AGE_40_49]/[POP2000])*100", "VB")
# pcnt50_64
arcpy.CalculateField_management(censusFC,"pcnt50_64","([AGE_50_64]/[POP2000])*100", "VB")
# pcnt65_UP
arcpy.CalculateField_management(censusFC,"pcnt65_UP","([AGE_65_UP]/[POP2000])*100", "VB")
# M_F_Ratio
arcpy.CalculateField_management(censusFC,"M_F_Ratio","([MALES]/[FEMALES])", "VB")
# pcntUnEdu
arcpy.CalculateField_management(censusFC,"pcntUnEdu","([NotHSGrad]/[EduPop]) * 100", "VB")
10) Saved the MXD, closed ArcGIS and ArcCatalog then ran the script.
11) I had one typo in my script so fixed that and reran it.
12) Opened up ArcCatalog to make sure it looked right.   I wasn’t sure if we needed to multiply by 100 on the male female ratio since it is a ratio rather than a percentage.    I decided I can always multiply by 100 down the road if the lab leads me that way.
13) Looks like all fields were created and populated


Part 2: Join Meth Labs to Census Blocks
Include notes in this section about how and why it was important to join the meth lab and census data. Explain any edits you had to make to the data.
1) Opened up my MXD Again
2) Opened the Spatial Join tool from the Analysis toolbox
3) Verified results
4) This created CensusTract_SpatialJoin layer which has the Join_Count field in it
5) Created a new field called LabDensity as type Float
6) Set this using Field Calculator to equal [Join_Count]/ [SqMile]
7) I found the properties page to be an easier way to toggle fields on and off:

Thursday, August 9, 2012

GIS 4048 Final Project Presentation

For my Final Project, I chose to use GIS to help decide where to place a new dog park in Leon County, Florida to best serve the population.

For this project we had to create a Process Summary, a PowerPoint Presentation (along with supporting maps) as well as a Slide by Slide summary in PDF form.

Link to Slide by Slide Summary

Link to PowerPoint Presentation

I experimented with ArcGIS Explorer Online for Extra Credit, but was unable to get the presentation to a point where I was happy enough with it to turn it in.   The Raster files especially were giving me trouble and I had too much extraneous things going on to dive into it any deeper.  


Friday, August 3, 2012

Module 8 - Cursors....

My Ever-Growing GIS/Programming Library
This module was an excellent view of cursors.   Cursors are essential to the toolbox of any programmer that works with data of any sort.   I was surprised to see the similarities in concept to the T-SQL environment of Microsoft SQL Server.

Notes to Future Self:
  • When debugging, remember not only to look at the line(s) of code where you THINK the problem is, but also at other lines that may execute.  I ran into a problem where I was convinced that the UpdateCursor just wasn’t working and then I went back a few lines and saw that my “query” was limiting the results that the operation was running.

  • When debugging, it is helpful to comment out lines and re-add them in smaller quantities to focus in like a laser on the area you are concerned with.
  • Also when debugging, remember to try various ways of running the program… PythonWin, IDLE, and by double clicking the script.   Insight might be gained from each one of these attemps.
  • Don’t reinvent the wheel…   The ArcGIS Online Help is GREAT on each command, including code snippets that might help as well.   Also, be sure to be competent at using your search engine of choice to look up both arcpy as well as general python fixes to get around any issues you are experiencing.