Skip to content

Quickstart

Randy McDermott edited this page May 30, 2023 · 29 revisions

ℹ️ Updated to qgis2fds 1.0

This wiki page describes how to set up your QGIS installation to import terrain data from the US LANDFIRE program, and export it to a NIST FDS case file for wildfire numerical simulation. You can download a working golden_gate.gqs example file created following the steps of this example from here. This same file can be used to export to FDS any terrain available on LANDFIRE from the whole US.

LANDFIRE (Landscape Fire and Resource Management Planning Tools) is a shared program between the wildland fire management programs of the US Department of Agriculture - US Forest Service and the US Department of the Interior - Wildland Fire Management Bureau providing landscape scale geo-spatial products to support cross-boundary planning, management, and operations in the US.

NIST FDS Fire Dynamics Simulator (FDS) is a large-eddy simulation (LES) code for low-speed flows, with an emphasis on smoke and heat transport from fires. FDS is the product of an international collaborative effort led by the US Department of Commerce - National Institute of Standards and Technology (NIST).

Before starting

You should already have the QGIS application installed on your computer, and the qgis2fds plugin enabled. If not, the Install wiki page explains how to do that.

If you are completely new to geographic information systems (GIS), I suggest the following preliminary interesting reads:

Overview of the procedure

To predict the potential behavior and effects of wildland fire, we need, in addition to the slope of the terrain, a surface fire behavior and fire effects model. This model describes the fuel bed inputs such as load, bulk density, fuel particle size, thermal properties, and moisture content.

For this reason, we are going to link two LANDFIRE data sources to your QGIS installation:

  • the digital elevation model, a 3D representation of terrain surface created from terrain elevation data for the whole US,

  • and the landuse data that describes the vegetation fuel bed inputs.

Different kinds of fuel models are used in fire science (See: Joe H. Scott Robert E. Burgan, Standard Fire Behavior Fuel Models). In this example, we are going to add the landuse layer offering the 13 Anderson Fire Behavior Fuel Model (F13). The F13 can be used as input to Rothermel's surface fire behavior and spread model.

After that we are going to create a new QGIS project.

A QGIS project is composed of geographic data layers. Each data layer is projected on the map according to its coordinate reference system (CRS). Your QGIS project also has an associated CRS.

A CRS defines how the coordinates of the two-dimensional projected map is related to real places on Earth. The data layer author chooses its CRS depending on the regional extent of the area they is working in.

The project CRS determines how data is projected from its underlying raw coordinates to the flat map rendered within the QGIS map canvas. QGIS supports on-the-fly CRS transformation for data layers. This means that regardless of the underlying CRS of particular data layers in your project they will always be automatically transformed into the common CRS defined for your project. Behind the scenes, QGIS transparently reprojects all the layers contained within your project into the project’s CRS so that they will all be rendered in the correct position with respect to each other. QGIS supports approximately 7,000 standard CRSs, each with a different use case. If you are wondering why so many CRSs have a reason to exist, read this specific chapter of A gentle introduction to GIS.

We then populate your new QGIS project with the LANDFIRE linked data sources, both elevation and landuse, and set the correct CRS for each. To facilitate the navigation on the map canvas, we can add an OpenStreetMap basemap layer on top.

At this point, all is ready for exporting the selected parcel of terrain to an FDS case.

So, let's start!

Step 1: Link LANDFIRE data sources to QGIS

Launch QGIS

and click on Layer > Data Source Manager in the main menu. Choose the WCS panel and click on the New button to create a new connection.

Type the following data in this panel fields:

Field Data
Name Landfire CONUS LF
URL https://edcintl.cr.usgs.gov/geoserver/landfire_wcs/us_220/wcs

Click on Connect and wait for the database to populate. Then click OK.

Repeat the same procedure for this second new WCS connection:

Field Data
Name Landfire CONUS Topographic
URL https://edcintl.cr.usgs.gov/geoserver/landfire_wcs/us_topo/wcs

At the end close the Data Source Manager.

These two LANDFIRE data sources are now permanently added to your QGIS installation.

For further details or updated links on these and other LANDFIRE WCS servers offering data sources visit the LANDFIRE data access page.

Step 2: Create a new QGIS project

Click on Project > New in the main menu and start a new empty project.

Step 3: Populate the new QGIS project with data layers

Add the digital elevation model layer

Look at the Browser panel and open the WCS > Landfire CONUS Topographic list. Drag-and-drop the LC20_Elev_220 (was: US_DEM2016) data source to the Layers panel of your project. A greyscale US map should appear in your project map canvas.

To setup this layer configuration, right-click on the LC20_Elev_220 layer name in the Layers panel and choose Properties. Its Layer Properties window opens up.

Select the Source label in the side panel. Then click on the small button to choose the right CRS for this layer.

The CRS selector opens up. Type EPSG:5070 in the filter field and select the NAD83/Conus Albers - EPSG:5070 CRS, if not already set. Then click OK.

All LANDFIRE data sources for the Conus region use this NAD83/Conus Albers - EPSG:5070 CRS, as explained in the LANDFIRE FAQ.

Whenever a Select Transformation window opens up, just click OK to accept the default choice for transformations between the different layer and project CRSs.

When back in the Layer Properties window, select the Symbology label in the side panel. Choose Render type > Hillshade to improve the digital elevation model layer appearance.

Close the Layer Properties window by clicking the OK button on the bottom. You are back to the map canvas of your project.

If after setting up the CRS the US map has disappeared, zoom in that layer again by using View > Zoom to Layer in the main menu.

Add the landuse layer

As already done for the digital elevation model layer, look at the Browser panel and open the WCS > Landfire CONUS LF list. Drag-and-drop the LC22_F13_220 (was: US_200FBFM13) data source to the Layers panel of your project. Then in its Layer Properties window, set this layer CRS to NAD83/Conus Albers - EPSG:5070, if not already set.

From the same Layer Properties window, select Symbology on the side panel. Load the Landfire F13.qml style by clicking on the Style > Load Style menu at the bottom of the window (if this style is not available, download it). If you want to see both the elevation and the landuse layers in your project map canvas, set Blending mode > Multiply.

The Landfire F13.qml style sets the appearance of the landuse layer to that of the LANDFIRE maps, using the right color for each of the 13 Anderson fuel models.

Close the Layer Properties window by clicking the OK button on the bottom. You are back to the map canvas of your project.

You can zoom in and pan to your desired location. For example, here is a view of landuse and elevation of the Golden Gate area in San Francisco, California.

Add the OpenStreetMap basemap layer

As already done for the previous layers, look at the Browser panel and open the XYZ Tiles list. Drag-and-drop the OpenStreetMap data source to the Layers panel of your project.

QGIS should automatically set the right CRS for this layer. Just in case, check it in its Layer Properties window. In general, the right CRS for web based maps is EPSG:3857 - WGS 84/Pseudo-Mercator.

If you are curious, This Wikipedia page explains why this CRS is a very good choice for web maps but not for other applications.

If you want to add other basemaps (eg. Google Maps, ...), enable the QuickMapServices QGIS plugin and follow its instructions.

Play with the Blending Mode in the Layer Properties > Symbology panel to obtain the following blended view of the Golden Gate area.

Create the fire layer and add a polygon to it

The polygons of the fire layer export burned areas and active fire lines to the FDS case.

Click on the menu entry Layer > Create Layer > New Shapefile Layer and you will be presented with the New Shapefile Layer dialog, which allows you to create a new vector layer.

Click on ..., navigate to the project directory and save your new layer as fire.shp. Then set Polygon from the Geometry type drop down menu.

After clicking OK the new layer should appear in your Layers panel.

Select the new fire layer, then drag it to the top. Click on the Toggle Editing button in the toolbar. As soon as you are in edit mode, you will see that some digitizing tools have become active: and . If you cannot find these buttons, check that the Digitizing Toolbar is enabled. There should be a check mark next to the View > Toolbars > Digitizing menu entry.

Notice that the layer fire in the Layers panel now has the pencil icon, indicating that it is in edit mode.

Now click on the Add Polygon Feature button to begin adding a fire polygon. Place the points by clicking on the map. After placing your last point, right click to finish drawing the polygon. This will finalize the feature and show you the Attributes dialog. Click OK, and you have created the first fire polygon. Add more if you want to test them.

When exported, the terrain covered by the polygon is set to be a Burned area and its borders are set to Ignition by default, like this:

becomes

If you want to add single ignition points, just draw very small polygons like this:

becomes

If an ignition point is not getting created, move slightly its small polygon towards the center point of a DEM layer pixel.

Other advanced and flexible uses of the fire layer are explained in more detail in this page TODO.

Step 4: Get and customize the landuse type *.csv file

The US_200F13_20 landuse layer that you just linked is a raster data source that describes the vegetation fuel bed inputs. Each type of fuel is associated to an unique integer value, as you can see in its attribute data dictionary.

To translate these integer values to the appropriate FDS boundary conditions, the qgis2fds plugin uses the Landuse type file that associates the values of the attribute data dictionary to the related FDS SURF namelist.

The Landuse type file is a comma-separated values file (*.csv) that has an header row and two columns containing:

  • the attribute value,
  • and the related SURF namelist string.

For example:

Landuse,SURF
0,"&SURF ID='NA' RGB=255,255,255 /"
1,"&SURF ID='A01' RGB=255,254,212 VEG_LSET_FUEL_INDEX=1 /"
2,"&SURF ID='A02' RGB=255,253,102 VEG_LSET_FUEL_INDEX=2 /"
...
99,"&SURF ID='Barren' RGB=133,153,156 /"
1000,"&SURF ID='Ignition' VEG_LSET_IGNITE_TIME=0. COLOR='RED'" /
1001,"&SURF ID='Burned' RGB=20,20,20 /"

Some preconfigured files for common landuse choices are available in the landuse_types directory of the qgis2fds package.

You can customize the boundary conditions for your use case with Libreoffice Calc or MS Office Excel, and export it to the *.csv format.

Beware that:

  • the two last lines of the file should always contain the Ignition and Burned boundary conditions, that are used by the fire layer algorithm;
  • the attribute value integers should be unique,
  • the SURF IDs of the FDS boundary conditions should be unique as well, or FDS will complain.

Step 5: Create the wind *.csv file

The Wind file specifies the data that is exported within the WIND namelist and its RAMP. This file is another comma-separated values file (*.csv) with an header row and three columns containing:

  • simulated time in seconds,
  • wind speed in m/s,
  • and wind direction in degrees.

For example:

Time,Speed,Direction
0,2,45
180,5,90
360,10,135

You can create the Wind file using Libreoffice Calc or MS Office Excel with your weather data, and export it to the *.csv format.

Step 6: Set your project CRS

By default QGIS sets a new project CRS to that of the first created data layer. As this is not always the best choice, let's set it to something different.

Click on Project > Properties in the main menu and select CRS on the side panel. Similarly to what you previously did, set your project CRS to WGS84 - EPSG:4326. The current project CRS is always displayed in the bottom-right corner of the map canvas of your project.

The WGS84 CRS offers latitude-longitude coordinates and is very popular in mobile mapping applications and outdoor GPS devices.

Step 7: Export the terrain to an FDS case

Look at the Processing Toolbox panel and double click on the Export to NIST FDS > Export terrain tool.

Then fill in the required information in the qgis2fds main panel:

In this example, we have chosen Slacker Hill as the domain origin.

For further guidance on each of the input parameters see this page.

After clicking on the Run button, the plugin starts crunching numbers.

Here is a short description of the phases of the export process:

  • first, qgis2fds creates a grid of points over the DEM Layer, using the same orientation and its pixel density; for each of these points, the plugin samples the elevation values from the DEM Layer and the landuse from the Landuse Layer;

  • then it reprojects the grid of points to the locally optimized UTM CRS;

The UTM system provides a constant distance relationship anywhere on the map, while in angular coordinate systems, like latitude and longitude, the distance covered by a degree of longitude differs as you move towards the poles and only equals the distance covered by a degree of latitude at the equator. The UTM system allows the coordinate numbering system to be tied directly to a distance measuring system. And all UTM coordinates are measured in meters.

  • the reprojected points are used as centers of quad faces that entirely fill the chosen terrain extent; the quad faces are split into triangles and the landuse values are assigned as their FDS boundary condition.

At the end of the process, a working FDS case file is written to disk.

The file contains all it needs to run smoothly in FDS without modification. But, of course, it needs specific customization. This can be accomplished in BlenderFDS, the free and open source user interface for FDS.

A temporary layer of the sampled points is created in the QGIS project. This layer can be removed, if not needed.

The case directory contains the textured image of the terrain, too. The image can be projected by Smokeview over the terrain, instead of the colors of the boundary conditions, to facilitate the interpretation of the wildfire simulation results.

Step 8: Run FDS

Running the FDS solver on the unmodified created case, the Smokeview setup is performed.

By opening the case in Smokeview, you can appreciate the result of your hard work. Here are the Golden Gate terrains, with and without the automatically created texture applied.

Step 9: Save the world

This is by large the most important step.

The impact of the climate emergency is in front of us. In 2020 bushfires have killed people and forced thousands to flee their homes. Many areas of the world saw record temperatures last summer and winter. The qgis2fds plugin is a small open source contribution to the protection of our beloved planet from wildfires.