Walking safe

Walking safe is an interactive visualization tool to help tourists to navigate safely in new cities. It uses open criminal data to inform tourists which locations may be dangerous zones.

Webapp

Check it out for yourself right here

Motivation

When planning trips to new places, tourists don’t have the habit of looking for possible risks in the region. As a result, they can end up in dangerous places and become crime victims. To avoid this scenario we created Walking Safe, a web visualization tool with the task of helping tourists to navigate safely.

Proposal

Our proposal is a webapp which display criminal data in a friendly and intuitive manner in a map. We took crime-related open data, parsed tourist relevant crimes and made available to the public. The webapp has a simple interface for helping tourists to have an overview of the crimes in the city or to zoom and get details about a specific region.

Functionalities

Walking safe possess the following functionalities:

Development stages

  1. Merge the functionalities of the three T3 assignments of IA369 made by the authors. The functionalities were the safety circle, the heatmap and the filter buttons.
  2. Add more cities to the project (São Paulo and Campinas).
  3. Store crimes in json blobs.
  4. Style google maps.
  5. Add information section, with more detailed statistics about the crime in the city and its streets.
  6. Add a photo slideshow with images of the streets inside the safety circle.
  7. Add cluster button, which display from 1 to 10 cluster criminal points.

Datasets

Currently the app has crime data for three cities: San Francisco (CA, US), São Paulo (SP, BR) and Campinas (SP, BR). The data was preprocessed to select only crimes that are relevant to tourists (e.g. assault is a crime relevant to tourists, while domestic violence is not). Furthermore, since all the project was written in English, the Brazilian crimes were translated to English. Also, Campinas and São Paulo datasets did not include latitude and longitude, so Google Maps Geocoding API was used to get these informations from the available address of the crime. The final data is a list of JSON objects with the following fields:

Severity was classified in the following way: If the crime type involves person-to-person interaction with force, intimidation, and/or coercion, than it is a High Severy Crime. If it does not involves person-to-person interaction, it is a Low Severity Crime.

The JSON files are stored as blobs at JSON Blob. In case of very big JSON files, the site can stop responding if simply copy and paste the JSON directly in their text editor. Therefore, we provided a Python script which takes a JSON blob as inputs and split it in smaller pieces.

Working with Google Maps API

For economical and safety reasons, we are not going to share this project with our own Google API Key. It will be available until July 25th,2017. After this, you need to:

  1. Visit your APIs Console Website
  2. Click in ‘Products and Services’ on the top left.
  3. Click on ‘API Manager’.
  4. Activate ‘Google Street View Image API’, ‘Google Places API Web Service’ and ‘Google Maps JavaScript API’.
  5. Click in ‘Credentials’ in the left side menu.
  6. Generate a new Credential and copy your Google API Key.
  7. Change HTML code line 49 to insert your key like the following:
src="https://maps.googleapis.com/maps/api/js?key=YOUR_KEY_HERE&libraries=visualization,places&callback=myMap">
 

How to add new data

In case you want to add new data to this project, the procedure is very simple:

  1. Get some crime data about a city. The data must have the following fields: type of crime, latitude and longitude.
  2. Pre-process the data to select only the types of crimes you think are relevant to tourists
  3. Add the severity of each type of crime
  4. Save crime data as a JSON
  5. Create crime clusters JSON using the crime data JSON and the cluster script available at this repo
  6. Split the crime data JSON into smaller blobs with blobs script, case need it
  7. Upload the JSON blobs at JSON Blob for the crime data and for the clusters
  8. Add the city name in the index.html select tag
  9. Update crime and city variables at the script.js

Technologies used

The project was developed using:

Lessons learned

At the end of every project it’s important to look back and reflect on the most important lessons learned. In this particular example, we learned:

Future improvements

The first major improvement that the tool need is more quality criminal datasets. Other important improvements are:

Inspiration

Walking safe is a capstone project for the discipline IA369, based on Alexandre Lopes following R notebook.

License

See the LICENSE file for license rights and limitations (MIT).

Authors