mumbai, 11pm. a friend is trying to walk home from the station. she opens google maps. it shows her the fastest route: 12 minutes through a poorly-lit lane behind a construction site.
it doesn't tell her that three incidents were reported there last month. it doesn't know about the broken streetlights.
google maps optimizes for speed. nobody optimizes for "will i feel safe walking here alone at midnight."
that gap bothered me. not as a product opportunity. as a basic failure of the tools we use every day. the information exists. street view shows you the broken streetlights. crime data is public. accident reports are searchable. but no navigation app connects these dots for you.
the problem
navigation apps optimize for speed and distance. that's it. no consideration for:
- road infrastructure quality (potholes, missing sidewalks, construction zones)
- accident hotspots (intersections with repeated fatalities)
- crime rates (assault, theft, harassment frequency by area)
- lighting conditions (streetlights working, dark stretches, visibility)
- pedestrian visibility (crosswalks, traffic signals, driver sight lines)
women, solo travelers, and children have no tool that answers the question: "which route is safest?"
the fastest route and the safest route are often different routes. sometimes by 2 minutes. sometimes by 15 minutes. the problem is that right now, you can't even see the tradeoff. you don't know the safest option exists because nothing surfaces it.
the approach
analyze actual street view images with Gemini Vision. cross-reference accident and crime data from web search. factor in weather conditions. score every route on a 0-100 safety scale. present 2-4 alternatives with clear safety context.
the key insight: street view images contain more safety information than any structured dataset. you can SEE broken fences, missing guardrails, narrow lanes with no sidewalk, abandoned buildings, poor lighting. a vision model can identify these hazards the same way a human would if they were standing there looking around.
combine visual analysis with historical incident data and you get something no existing tool provides: a route recommendation that accounts for both visible infrastructure and recorded history.
how the scoring works
6 factors, weighted by their actual contribution to pedestrian safety:
- road infrastructure (30%): sidewalk presence, road width, barriers, guardrails, surface condition, construction zones
- traffic conditions (25%): vehicle speed, traffic density, intersection complexity, pedestrian signals
- accident history (25%): reported accidents in the area, fatality rate, accident recency, repeat locations
- environmental factors (10%): lighting, weather impact, visibility, time of day adjustments
- human factors (10%): pedestrian density (more people = safer), nearby establishments open, security presence
street view images are sampled at evenly-spaced points along the route. maximum 10 sample points per route. Gemini Vision analyzes each image for visible hazards.
calibration benchmarks: good roads with proper infrastructure score 15-25 (lower is safer). moderate concerns (missing sidewalks, dim lighting) score 30-45. genuinely dangerous stretches (no barriers, blind corners, reported incidents) score 60+.
the scoring is inverted intentionally. 0 means perfectly safe. 100 means extremely dangerous. this matches how risk scores work in other domains and makes the comparison intuitive: lower number, better route.
the pipeline
route generation
user enters source and destination. Google Maps Routes API returns 2-4 alternative routes. each route comes as an encoded polyline.
point sampling
polyline decoded into coordinates. points sampled evenly along the route (not random, not clustered). even spacing ensures the entire route gets analyzed, not just the endpoints or the middle.
data collection (per point)
for each sampled point, four things happen in parallel:
- fetch street view image (Google Street View Static API)
- reverse geocode to get area name and locality
- search for recent accidents in that area (Google Custom Search)
- search for recent crime reports in that area (Google Custom Search)
parallel analysis
three analysis tracks run simultaneously:
- Gemini Vision (image scoring): analyzes each street view image for visible infrastructure quality, lighting, hazards, pedestrian amenities
- accident agent (LangChain + web search): evaluates accident history for the area, identifies patterns, assesses recency
- crime agent (LangChain + web search): evaluates crime reports, identifies hotspots, assesses severity and frequency
score aggregation
per-point scores get aggregated into a per-route score. the worst segment along a route has outsized influence (a route is only as safe as its most dangerous stretch). this prevents a scenario where a mostly-safe route with one extremely dangerous crossing gets an "average" score that hides the risk.
presentation
routes presented with safety badges, risk areas highlighted on the map, emergency contacts nearby. the user sees: route A is 12 minutes with a safety score of 28. route B is 16 minutes with a safety score of 14. the extra 4 minutes buys you significantly better infrastructure and lighting. your choice.
features
- route comparison with safety scores: side-by-side comparison of all alternatives. time vs. safety tradeoff made explicit.
- street view preview gallery: see the actual images from your route before you walk it. know what you're getting into.
- turn-by-turn with safety alerts: "in 200 meters, you'll enter a stretch with no sidewalk. stay on the left side facing traffic."
- emergency contacts map: hospitals, police stations, fire stations along your route. one tap to call.
- multi-mode support: walking, driving, cycling, transit. safety factors differ by mode (a cyclist cares about different things than a pedestrian).
- weather integration: OpenWeatherMap data adjusts scores in real-time. rain on a road with poor drainage is more dangerous than clear weather on the same road.
what makes this different
actual street view images
not theoretical road types from a database. actual photos of the actual road you're about to walk on. the vision model sees what you would see if you were standing there. broken fence? it sees it. no streetlight? it sees it. narrow lane with trucks? it sees it.
real-time web search for recent incidents
not stale historical data from a government dataset updated annually. live web search for recent accident and crime reports. if something happened last week, it shows up in the scoring. the data is as fresh as Google's search index.
multi-factor fusion
6+ data sources fused into a single score. no other navigation tool combines: visual infrastructure analysis + accident history + crime data + weather + lighting + pedestrian density into one decision framework.
context-aware baselines
different baselines for different regions. a road in mumbai and a road in copenhagen have different standards for "normal." the scoring adjusts. what's acceptable infrastructure in one context might be dangerously inadequate in another.
tech stack
- frontend
- React + TypeScript + Vite
- maps
- Google Maps SDK (routes, street view, geocoding)
- vision
- Gemini 1.5 Flash (street view image analysis)
- agents
- LangChain (accident + crime analysis agents)
- weather
- OpenWeatherMap API
- search
- Google Custom Search (accident/crime data)
live at safemaps.fun.
what i learned
the most surprising thing: the data was already there. street view images exist for almost every road. accident reports are searchable. crime data is public. the infrastructure information is sitting in photos that Google already took.
nobody had connected the dots because navigation is treated as a routing optimization problem, not a safety problem. the entire industry optimizes the same objective function: minimize time or minimize distance. adding "minimize risk" as a third objective changes what the system even looks for.
the other thing: vision models are genuinely good at this. Gemini correctly identifies missing sidewalks, broken streetlights, narrow lanes, construction hazards, and poor visibility conditions from street view images. it's not perfect. but it's better than nothing, which is what people have right now.
better than nothing, available right now, for the person walking home at 11pm. that's enough reason to build it.