Devising a Safe Path To Travel In The Aftermath Of An Earthquake

Data-driven mapping to create safe, fast earthquake evacuation routes in Los Angeles using risk factors, OSMnx data and advanced path-finding.

Sanjana Tule, Nishrin Kachwala
Sanjana Tule, Nishrin Kachwala

February 19, 2025

12 minutes read

article featured image

California experiences frequent seismic activity due to its position along the San Andreas Fault and a network of hundreds of other fault lines. With more than 10,000 earthquakes striking the state each year, effective preparedness becomes essential. In the aftermath of a major quake, protecting lives depends on clear, well-planned evacuation strategies that reduce confusion and guide families to safety.

A Four‑Week Route‑Planning Challenge

Following a major earthquake, damaged roads, unstable buildings, and unsafe ground conditions make evacuation extremely risky. In a densely populated city like Los Angeles, choosing the wrong route can increase the risk of injury or delay access to safety. Since most navigation systems optimise only for speed or distance and ignore earthquake-specific hazards, this four-week challenge aimed to design a safety-aware routing system that guides residents along safer paths toward parks and shelters by considering real-world risk factors.

Building the Data Pipeline

The project focused on building an end‑to‑end pipeline to move from risk factor collection to their use in finding safe paths in the aftermath of an earthquake. A team of collaborators collected data about earthquake‑related risks, combined those data within a geospatial framework and applied path‑finding algorithms to plan evacuation routes. Potential shelters and parks were also identified so that users could select those locations as destinations. The study presented a proof of concept for safe paths across three Los Angeles neighbourhoods—Chatsworth, Northridge and North Hills in the San Fernando Valley.

Figure 1: High‑level data pipeline from collecting risk factors to finding a safe path.

Mapping the Street Network with OSMnx

Most of the risk factors were derived from the features available in OSMnx, a Python package that lets you download geospatial data from OpenStreetMap and gives you access to real‑world street networks. A typical OSMnx graph is a multidigraph consisting of nodes (representing intersections or dead‑ends) and edges (representing street segments that link them). OSMnx also provides access to other geospatial objects such as buildings, parks and schools. These graphs can be converted to and from GeoPandas node and edge GeoDataFrames, making them extremely versatile for manipulating and adding additional information to nodes or edges in any geographical area. Because OSMnx draws data directly from the OpenStreetMap community, it provides up‑to‑date and detailed street‑level information that is critical for modelling Earthquake Evacuation routes in densely populated areas. The OSMnx graph for the three neighbourhoods used in this challenge is shown below.

Figure 2: OSMnx graph (edges) for Chatsworth, Northridge and North Hills (from left to right).

Assessing Risk Factors

Five risk factors were considered as proxies for travel safety in the context of earthquakes: distance from buildings, road width, building density, road speed and liquefaction. Each factor captures a different aspect of the hazards people might encounter during an earthquake evacuation:

  • Distance – Roads far from nearby buildings reduce the likelihood of falling debris.
  • Road width – Narrow residential roads are riskier, while wider highways provide safer passage.
  • Building density – Densely built areas pose more danger because more structures could collapse onto streets.
  • Road speed – Higher speed limits typically indicate broader roads and correspondingly lower risk.
  • Liquefaction – Some soils lose strength during strong shaking; liquefaction zones were identified using data from the Geohub LA website.

Taken together, these factors provide a multi‑dimensional picture of street safety. A road with low building density but high liquefaction potential might still be dangerous, and an otherwise safe, wide road can become perilous if lined with tall structures. By quantifying and weighting each attribute, the analysis captures nuance that a single factor alone would miss.

Distance from Buildings

The distance factor quantifies how far a particular road segment is from nearby buildings. In a disaster such as an earthquake, travelling close to buildings increases the risk of being injured by collapsing structures. To measure distance, the team first segmented buildings and roads using building footprints from OSMnx. They then applied a Euclidean distance transformation using the Scipy function distance_transform_edt. This function calculates the distance from each pixel to the nearest building pixel. The resulting distances were averaged for each road edge and stored as a score on the OSMnx graph.

Figure 3: Building footprints from OSMnx and the same footprints after the distance transformation.

The transformation highlights how open spaces on the map are more likely to provide safer travel corridors. Roads with greater separation from buildings appear as bands of warmer colours, while streets adjacent to structures retain cooler hues. This visualisation helps planners intuitively understand the distance‑based risk at a glance.

Figure 4: A zoomed‑in view of the lower left corner of the footprint from Figure 3 with its corresponding distance transformation output. Buildings appear in red, and green or yellow pixels indicate increasing distance from buildings.

Building Density

Building density reflects how sparse or dense structures are in a given area. To derive this metric, the team divided the geographical area into a grid and used OSMnx’s geometries_from_bbox function to count the number of buildings within each grid cell. Roads within a densely populated cell inherited a higher density score because more buildings mean greater danger of debris.

Figure 5: Building density risk score visualised on the OSMnx graph. A heatmap depicts the severity of the risk: darker colours indicate denser, riskier areas.

Speed, Width and Liquefaction

Speed and width factors derive from attributes in the OSMnx graph. Maximum speed was used as a proxy for wider, safer roads, and the “highway” category indicated road width. Residential roads were tagged as riskier, while motorways were considered safer. Both of these factors assigned discrete risk scores between zero and five. The liquefaction factor comes from the Geohub LA resource on liquefaction zones. Liquefaction zones identify soils where stability must be investigated and mitigation measures should be undertaken. Areas marked as liquefaction zones were assumed to be more prone to danger in the aftermath of an earthquake.

Locating Safe Destinations

Research on safety during earthquake highlights the importance of moving to open spaces if you are outdoors when the ground shakes. In this project, parks and designated shelters were considered possible safe destinations. Parks were extracted from OSMnx building footprints, and shelters were obtained from publicly available data. To make these destinations accessible during path planning, nodes near parks or shelters were tagged as special evacuation points.

Open spaces reduce the risk of injury from falling debris and provide room for emergency responders to operate. However, urban neighbourhoods often lack sufficient open areas, so integrating shelters into the network ensures that residents always have a reachable safe option.

Integrating the Data

Once all risk factors were assembled and stored on nodes and edges, the next step was to integrate them into a single graph. GeoDataFrames make it easy to merge multiple attributes and combine information from different neighbourhoods. Nodes were annotated with their evacuation type, name and a flag indicating whether they correspond to a park or shelter, while edges contained separate columns for each risk factor.

By unifying these diverse data sources, the team created a single model that could be analysed algorithmically. This integration step is key to turning raw spatial data into actionable insights for emergency planners.

Figure 6: Nodes in the OSMnx graph with evacuation nodes tagged with evacuation type, name and flag.

In the visualisation of nodes, evacuation points are labelled with descriptive metadata. Each node represents a specific location, and flags indicate whether that location is a park, a shelter or a standard street intersection. This node‑level information feeds into the path‑finding algorithms by marking potential start and end points for evacuation routes.

Figure 7: Edges in the OSMnx graph with risk factors stored in separate columns.

Combining Risk Scores and Visualising Safety

By contrast, the edge table aggregates risk scores for each road segment. Each column corresponds to one of the five risk factors, and the scores can be combined to produce a single risk metric. Together, the node and edge data provide a comprehensive representation of the street network.

After merging the neighbourhoods and combining the risk factors, a single combined risk score was computed for every edge. This score integrates distance, width, density, speed and liquefaction into a single value that serves as the edge weight for downstream path‑finding. In the visualisation below, dark red edges are riskier while blue edges represent safer routes.

Path‑Finding Algorithms

With a combined risk score in place, the team explored two path‑finding algorithms: A* search and Hierarchical A* search. Both algorithms require an edge weight; in this case the weight was derived from the combined risk score. For each source–destination pair, three weighting schemes were compared: length alone, risk alone and the product of length and risk. As shown below, the weight that multiplies length by risk provides a balanced trade‑off. Using only distance may deliver a short but hazardous route; using only risk reduces exposure but may lengthen the trip excessively.

Selecting an appropriate weight therefore becomes a policy decision: some communities may prioritise minimising exposure to risk even at the cost of time, while others may emphasise speed to reach safe zones quickly.

Hierarchical A* Search

The Hierarchical A* search algorithm was inspired by a research paper that proposes near‑optimal hierarchical path finding. A hierarchical abstract graph is pre‑computed offline and stored on disk. To construct this abstract graph, the area was divided into a 5 × 5 grid, resulting in 25 blocks. Entry and exit border nodes between blocks formed the intra‑edges of the abstract graph, and inter‑edges within blocks were calculated by applying A* search using the combined risk multiplied by length as the weight.

At runtime, the hierarchical path search combines three sub‑paths:

  • From the source node s to the nearest abstract node sa using the detailed OSMnx graph (s → sa).
  • From the destination node d to the nearest abstract node da using the detailed graph (d → da).
  • From the abstract source sa to the abstract destination da using the hierarchical graph (sa → da).

Figure 10: Hierarchical abstract graph for the three Los Angeles neighbourhoods (left) and a runtime path found between a source and destination using hierarchical A* search (right).

Comparing the two algorithms shows that Hierarchical A* search is faster for long‑distance queries while its risk‑to‑length ratio remains near‑optimal relative to the standard A* search. The figure below summarises risk and computation time for different source and destination cases.

Figure 11: Risk and time comparisons between A* search and Hierarchical A* search across different source–destination pairs.

Building an Interactive Tool

The final step was to build a user‑friendly web application in Python using Streamlit. The web app allows users to enter a starting address and choose their destination type—parks, shelters or a custom location. Once the user submits the form, a safe path is displayed along with its length and risk score. The interface also includes a heatmap visualising the combined risk across the neighbourhood and highlights the nearest parks and shelters.

Figure 12: Streamlit web application demonstrating how to devise a safe path in the aftermath of an earthquake.

In addition to the interactive interface, it is helpful for users to understand the spatial distribution of risk. The following heatmap overlays the combined risk score onto the neighbourhood map and highlights where parks and shelters are situated so that residents can easily compare potential destinations.

Figure 13: Combined risk heatmap with parks and destinations highlighted.

Conclusion

This four week challenge demonstrates how open data, geospatial analysis and collaborative AI development can meaningfully improve public safety in earthquake prone cities. By integrating multiple real world risk factors into a unified model and designing a practical safety aware routing system, the team showed that evacuation planning can be faster, smarter and far more protective than traditional navigation tools. With further scaling and added risk layers, solutions like this can guide millions of residents toward safer routes during emergencies, reducing injuries, supporting responders and strengthening community resilience as disasters grow more frequent and severe.

Accelerate your disaster preparedness efforts by collaborating with Omdena and creating AI systems that deliver life saving insights in real time.

FAQs

How does this system determine the safest evacuation route after an earthquake?
Yes. Since the system is based on real geospatial data, it can be updated with new hazard layers or altered road conditions. When fresh risk data is added (e.g., damaged bridges, road closures), the algorithm can recalculate safer alternative paths.
Parks offer open spaces with minimal structures, reducing the risk of falling debris during aftershocks. Shelters, sourced from official public datasets, are designated safe facilities equipped to support people after a major disaster. Both are integrated into the routing model as validated endpoints.
While this project focused on three neighbourhoods in Los Angeles, the methodology is fully scalable. Any region with OpenStreetMap data can be mapped, risk factors can be re-calculated and safe routes can be generated using the same pipeline.
Risk scores are derived from real-world data: OSMnx street attributes, building footprints, density calculations and official liquefaction maps. By combining multiple risk indicators, the model offers a more realistic representation of danger than using any single factor alone.
Not at all. The interface is designed to be simple—users enter their starting point, choose a destination type and the app automatically generates the safest available route along with a risk heatmap for better understanding.