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:

No comments:

Post a Comment