Exploring Risk of Landslides in Nepal
By: Daina Andries
Tags: Mapbox, Data Science, R, Nepal, Risk

Sites of Landslides in Nepal coincide with areas of above average annual rainfall

Project Overview

The web app featured in this blog is a submission to the #VizRisk 2019 challenge. Click here to experience the interactive map.

I chose to work on visualizing regions at risk of landslides in Nepal. My starting point was the data on landslides triggered by rain provided through the NASA Global Landslide Catalog. The catalog contained a record of 358 historical landslides in Nepal. The date range of the data provided by NASA spanned March 2007 to March 2015.

Questions from the #VizRisk challenge were:

How can national officials and organizations reduce the negative impact of landslides?

Which communities are most vulnerable?

How might the loss of a road impact people’s travel times?

Where might impacts be the most severe, or the most preventable?

To begin to find answers to some of these questions, I designed a map to help localize historical landslides. Filter controls contribute to ease of exploring historical landslide data, enabling users to group events by features such as severity and time of occurrence. As app users subset the data provided and zoom into regions of the map, the base map details indicate proximity to roadways and developed areas as well as accelerated changes in slope gradient via contour lines.

Context

I reviewed this resource from the ICIMOD library to become more familiar with the subject of landslides in Nepal (NASA’s Global Landslide Catalog is mentioned on page 45). Being mountainous, the majority of Nepal’s terrain is landslide prone. There are many angles from which to assess landslide risk; these include slope aspect and gradient, deforestation, rainfall, earthquakes, mining, and melting snow.

Given the availability of open datasets on Nepal rainfall online as well as the fact that the majority of the NASA records were tagged as with continuous rain as the cause, my focus quickly became localizing rainfall triggered landslides. As I designed the map, however, I tried to incorporate references to factors other than rain wherever possible without overcomplicating the interface.

Choice of Base Map

To provide a visual reference to slope gradients, I chose a contour map as my base map. I took the Convert Units example map from Mapbox studio as my starting point, changing the background of the map to a darker tone to provide greater visual contrast with the rainfall raster. I also added a red roadways layer to show the proximity of historical landslide sites to road infrastructure in the mountains of Nepal.

Click here to view the base map by itself in Mapbox studio.

Mapbox Integration with Leaflet in R

I opted to build my visualization in R shiny because of the options for creating interactive map controls using the leaflet library for R. I have worked a lot with leaflet for R and feel at home with this library; however, a new challenge for me was figuring out the URL shiny needed to integrate my base map from Mapbox studio with my R leaflet map as a custom tile set.

After some experimenting, I found that the following URL would get my Mapbox base map to render in my shiny app:

The following code snippet shows the code for creating the map in R’s leaflet package in R shiny . A few of the functions are from additional add-on libraries relating to the leaflet package, specifically the leafem , leaflet.opacity , leaflet.mapboxgl and leaflet.extras libraries.

output$NepalRain <- renderLeaflet({

addTiles(

"

attribution = 'Maps by <a href="

) %>%

addRasterImage(precip, layerId= "Rainfall",

colors=rgb(0/555, 1:445/450, 5/100),

opacity = 0.8) %>%

addOpacitySlider("Rainfall") %>%

addRasterImage(raster_layer, layerId= "Elevation",

colors=rgb(375/555, 1:445/450, 5/100), opacity = 0) %>%

addMouseCoordinates() %>%

leafem::addImageQuery(raster_layer,

type="mousemove",

layerId = "Elevation",

position = "topright") %>%

addLegend(pal = pal,

values = raster_values[!is.na(raster_values)],

title = "Rainfall (mm)",

position = 'bottomright') %>%

addDrawToolbar(

polylineOptions=FALSE,

markerOptions = FALSE,

circleMarkerOptions = FALSE,

polygonOptions = drawPolygonOptions(

shapeOptions=drawShapeOptions(fillOpacity = 0,

color = 'white',

weight = 3)),

rectangleOptions =

drawRectangleOptions(

shapeOptions=drawShapeOptions(fillOpacity = 0,

color = 'white',

weight = 3)),

circleOptions = FALSE,

editOptions = editToolbarOptions(edit = FALSE,

selectedPathOptions = selectedPathOptions()))

}) leaflet() %>%addTiles( https://api.mapbox.com/styles/v1/dainaandries/cjxxfhzrvbztm1dtev60x044h/tiles/{z}/{x}/{y}?access_token={MY_ACCESS_TOKEN }",attribution = 'Maps by http://www.mapbox.com/ ">Mapbox') %>%addRasterImage(precip, layerId= "Rainfall",colors=rgb(0/555, 1:445/450, 5/100),opacity = 0.8) %>%addOpacitySlider("Rainfall") %>%addRasterImage(raster_layer, layerId= "Elevation",colors=rgb(375/555, 1:445/450, 5/100), opacity = 0) %>%addMouseCoordinates() %>%leafem::addImageQuery(raster_layer,type="mousemove",layerId = "Elevation",position = "topright") %>%addLegend(pal = pal,values = raster_values[!is.na(raster_values)],title = "Rainfall (mm)",position = 'bottomright') %>%addDrawToolbar(polylineOptions=FALSE,markerOptions = FALSE,circleMarkerOptions = FALSE,polygonOptions = drawPolygonOptions(shapeOptions=drawShapeOptions(fillOpacity = 0,color = 'white',weight = 3)),rectangleOptions =drawRectangleOptions(shapeOptions=drawShapeOptions(fillOpacity = 0,color = 'white',weight = 3)),circleOptions = FALSE,editOptions = editToolbarOptions(edit = FALSE,selectedPathOptions = selectedPathOptions()))})

The code for rendering the circles marking sites of historical landslides is deliberately separate from the snippet above. The drawing of these circles is invoked as an event observer in shiny , reacting to the various filters associated with the variable nepal_landslides . This feature gives users full control over displaying historical landslide markers by date, month, or count of fatalities. The radius of the circles is set to be proportionate to the distance of the landslide — the factor by which the radius is multiplied can be adjusted to the user’s preference.

observeEvent({input$dates

input$rain_months

input$fatalities

input$radius}, {



if(nrow(nepal_landslides()) == 0) {

leafletProxy(“NepalRain”) %>%

clearShapes()

} else { locationLabels <- sprintf(

“<strong>Id: %s</strong><br/>

Date: %s <sup></sup><br/>

Near %s <sup></sup><br/>

%g Fatalities, Population of %s <sup></sup>”,

nepal_landslides()$objectid, nepal_landslides()$date_date_,

nepal_landslides()$nearest_pl, nepal_landslides()$fatalities,

nepal_landslides()$population

) %>% lapply(htmltools::HTML)



leafletProxy(“NepalRain”) %>%

clearShapes() %>%

addCircles(data = nepal_landslides(),

radius = nepal_landslides()$distance * input$radius,

lat = nepal_landslides()$latitude,

lng = nepal_landslides()$longitude,

fillColor = “white”,

fillOpacity = 1,

color = “wheat”,

weight = 2,

stroke = T,

layerId = as.character(nepal_landslides()$objectid),

label = locationLabels,

highlightOptions = highlightOptions(color = “brown”,

opacity = 1.0,

weight = 2,

bringToFront = TRUE))

}



})



nepal_landslides <- eventReactive({input$dates

input$fatalities

input$rain_months}, {



req(!is.null(input$rain_months))



date1 <- input$dates[1]

date2 <- input$dates[2]



nepal_landslides <- subset(landslides, countrynam==’Nepal’)

nepal_landslides$month <-strsplit(as.character(nepal_landslides$date_date_), “/”) nepal_landslides$month <- sapply(nepal_landslides$month, function(x) x[2]) nepal_landslides <- subset(nepal_landslides, month %in% input$rain_months) nepal_landslides$date_date_ <-as.Date(nepal_landslides$date_date_) nepal_landslides <- subset(nepal_landslides, date_date_ >= input$dates[1] & date_date_ <= input$dates[2]) nepal_landslides <- subset(nepal_landslides, fatalities >= input$fatalities[1] & fatalities <= input$fatalities[2])



if(nrow(nepal_landslides) > 0) { nepal_landslides$objectid <-

as.character(nepal_landslides$objectid) nepal_landslides$secondobjectid <- paste0(nepal_landslides$objectid, “_selected”) } else { return(nepal_landslides) }



nepal_landslides })

Both the complete shiny app source code, as well as the R script used to create a custom raster image file (described in the next section), are available here on GitHub.

Rainfall and Elevation Data

Since the central feature of the web app would be a map of Nepal, I searched online for raster files that I could incorporate into the map. I found detailed elevation rasters at this digital elevation data repository maintained by Jonathan de Ferranti, a link I initially found through CGIAR. I downloaded 47 raster files and used the R libraries rgdal and raster to create a custom compressed file.

The raster layer below was the final result:

Elevation raster with embedded elevation data displayed in RStudio

Ultimately, this raster would be included in the final map, but not in a visual capacity. The principal visual would be the rainfall raster. While invisible, the elevation raster would be accessible via mouseover. As the user moused over the map, a tooltip would provide elevation information for that area of the raster. This way, touching the screen or moving mouse would offer users a sense of the change of slope as well as slope direction (increase vs. decrease), functional at the lowest zoom levels while also complementing base map contours at higher zoom levels.

Historical landslide sites on contour map, with Elevation Data mouseover

The rainfall raster was downloaded from the Humanitarian Data Exchange, a data service provided by UNOCHA:

HDX raster showing annual precipitation in Nepal from 1980–2000, displayed in RStudio

The annual rainfall data provided for Nepal was available for the years 1980–2000. This date range did not coincide or overlap at all with the date range of the data from the Global Landslide Catalog provided by NASA. Nevertheless, combining the data from these two time periods in the final map revealed a compelling (though not surprising) visual history.

Rainfall Distribution and Landslide Probability

Distributions of historical climate data, while never guaranteeing accurate predictions of future events, can yield insights into probability of recurrence.

Annual rainfall distribution on the bottom left shows “average” annual rainfall in Nepal is about 2000 mm

The rainfall raster is green, with the brightest green areas indicating the heaviest rainfall per year. The circles showing locations of historical landslides occurring between 2007 and 2015 follow the green shading based on data from 1980–2000 fairly closely, despite the disparity of times when the two datasets were recorded. Moreover, the brightest green areas in the vicinity of Pokhara coincide with the highest concentration of recorded rainfall triggered landslides in 2007–2015, suggesting a certain amount of predictability due to the consistency of the monsoon patterns.

Using the filter controls on the left, I was able to go a step further in examining the frequency of the monsoon rains as triggers of landslides. Filtering on the months of June through September returned 329 records out of 358; in other words, approximately 92% percent of the rain-triggered landslides in the NASA catalog occurred between June and September.

Using the Map to Drill Into the Data

At lower zoom levels, the rainfall raster is intended to be the focus of the visualization, defining the boundaries of Nepal while orienting the user to regions and districts with the highest concentrations of rain-triggered landslides. As the user zooms in, however, the map permits more detail-oriented exploration of a localized area. To facilitate viewing of the contours, roads and major waterways around villages, parks, schools and past sites of landslides, an opacity slider has been included in the upper right. The green rainfall raster’s transparency can be decreased or made completely invisible as the user sees fit.

Landslides around Kathmandu, the capital city of Nepal

As briefly mentioned in the discussion of the code snippets from the section on integrating Mapbox with Leaflet in R, the circles shown on the map will dynamically adjust according to changes in the map filter settings on the left panel. Users can toggle between the MAP and DATA tabs on the shiny app to access more metadata about specific landslides. Only sites appearing on the map will appear in table on the DATA tab. If users wish to filter the data spatially rather than by data associated with the landslides (such as date, month, etc.), there is a bounding box selection feature included in the map that allows for this.

Marker selection with R geoshaper bounding box feature facilitates further map-based filtering of the data

This feature allows for quick exploration of concentrations of landslide sites to see if these events share common characteristics.

Some quick high-level insights the app revealed:

Approximately 52% of the recorded landslides had zero fatalities on record. This naturally raises the question of why there were no fatalities — most likely, what comes to mind is that the landslide occurred far enough away from any human development that no loss of human life occurred. These records remain important as sites at risk of landslide, especially for travelers and transport. The remaining 48% of the landslide areas can immediately be given priority by national officials and humanitarian organizations to focus their resources on areas with higher populations.

Communities that are most vulnerable appear to be where monsoon rainfall is around or above the national average for annual precipitation.

This dataset did not show the severity of landslides to be localized. The top three most devastating landslides of 2007–2015 occurred in three sites that were very distant from one another. This suggests that the severity of a landslide would be a harder variable to predict in a risk model. More data on the nature of local land use, deforestation, drainage, rock strength and quality of the soil would be helpful in predicting severity as well as formulating prevention strategies in high-risk regions.

Next Steps and Reflections

The insights provided through this map are just a beginning. With more data and added data dimensions, there is much more potential for discovery.

More rainfall data would be worth visualizing in the form of a time series to detect changes or anomalies in rainfall patterns over a period of the last few decades. Some examples of useful geographic data to incorporate into a map for landslide risk assessment would likewise include more detailed geological and land use data as well as locations of major fault lines.

Creating this exploratory map was a great exercise in understanding the power of geospatial visualization for making a dataset more accessible. Combining the tabular data provided by NASA catalog with a contour base map and a rainfall raster image instantly highlighted the correlation of high concentrations of landslides with annual precipitation levels in excess of the national “average”. No other visualization could convey this relationship between weather and location so quickly and clearly.