Crime Analysis
These scripts were created as part of a group project with three other classmates in an Advanced GIS course at Brock University. The goal was to create scripts that allow the user to begin with raw excel files of crime data (as points) and a boundary polygon file (such as zip codes) and end up with a layer that illustrates the percent change in crime in each boundary area over a period of time.
Script 1: Convert CSV file to Feature Class
This script requires a CSV file containing, at a minimum, an X and Y co-ordinate field. The user must simply copy and paste the names of the and Y co-ordinate fields from the CSV file and paste it in the appropriate inputs in GUI seen below on the left. The user must also create a File Geodatabase.
Script 2: Crime Counter
This script creates a new field in a polygon feature class. Then, it counts the number of points (from a separate point shapefile) that exist within each polygon area and writes those values to the newly created field. Before running Script 3, this tool would ideally be ran twice on two different years' worth of crime data to produce two new fields. There is also an option to include an SQL select statement so that the tool counts only crimes with a certain attribute. For example, this would be useful if the original CSV file contained a 'Type of Crime' field along with the required X and Y co-ordinate fields. The user could insert a query to count, for example, only Drug related crimes, and then compare the change in drug related crimes to substance abuse centers (scroll down to view an example). The result of this script is a layer that shows the number of crimes that occurred in each boundary area.
Script 3: Calculate Percent Change
This script calculates the percent change between the two fields (obtained by running Script 2) that the user inputs and writes the % change values to a new field which the user defines. The two fields must be within the same Feature Class along with the new % change field. The script will display an error message if the user enters a field name that already exists.