Walking alone in big cities can be a bit scary and dangerous, specially if you're not from around. It would be useful to know which areas to avoid and to feel like you've got someone watching your back. WalkPal is that pal. It gives you walking directions to anywhere while avoiding dangerous areas using ML and contacting emergency contacts in the unfortunate event of an emergency.

What it does

Uses ML techniques to avoid dangerous areas, and to alert emergency contacts when danger is detected

How we built it

Data recollection and clustering

As part of transparency efforts, many big cities have a publicly available dataset of reported crimes, many times with included latitude and longitude. Through K-means clustering, dangerous area points can be detected for each city, each with its associated report count and radius size. The idea is that if an area has many crime reports, it can probably be classified as "dangerous".

Walking directions avoiding dangerous areas

Google Maps API provides the walking directions from point A to point B. However, a special algorithm was needed to avoid the dangerous areas whenever possible (there are some cases where it is impossible to avoid dangerous areas). In rough terms, it uses the intersection of tangent lines to determine stopping points such that dangerous areas can be avoided. TODO: Add image

Then, the Google Maps API gets called again using said points as waypoints, so that the returned path avoids as many dangerous zones as possible. Results are also cached for better responsiveness.


SMS messages are automatically sent to the user's defined emergency contacts. This is done automatically on the server (users' contacts are not stored) using Twilio Messaging APIs


The above backend functionality was implemented in a Flask Server running on Google Cloud

Client App

The client app was developed in Flutter, using the google_maps_flutter plugin. The app also includes Place search functionality, detection for when the user starts running or deviates too much from the route.

Challenges we ran into

The main challenge was determining the path between two points while avoiding a certain set of points, as the Google Maps API does not provide that feature yet. It was however very interesting diving into the geometry and maths of the problem and trying to come up with the best solution.

Accomplishments that we're proud of

I am very proud of how the obstacle avoidance algorithm works, and on the impact this project can have on people all around the world.

What we learned

What's next for WalkPal

I intend to add data for more cities in the future, as well as improving the obstacle avoidance algorithm and providing real-time updating of dangerous areas.

Share this project: