Viewing a statistical summary of vector layers

It is often useful to have an at-a-glance view of a vector layer's statistics when you are working on a project. QGIS has a Statistics Panel that allows you to view a long list of descriptive statistics for whichever vector layer you choose. In this section, we will review the capabilities of the statistical summary tool in QGIS.

To open the statistical summary tool, either click View | Statistical Summary or View | Panels | Statistics Panel. This will open the Statistics Panel, shown in the following screenshot. Like all other panels, it can float on the screen, or be set to dock, so you may need to search your screen to find the panel:

Viewing a statistical summary of vector layers

The Statistics Panel is not that exciting without data to summarize, so we will use the Counties.shp file from the sample data:

  1. Add Counties.shp to the QGIS project.
  2. In the Statistics Panel, choose Counties in the top combo box, then choose CattleCalv in the field selector box.

The statistical summary for the number of cattle and calves in the lower 48 states in the USA is displayed in the Statistics Panel. There are quite a few summary statistics available, such as count, sum, mean, median, mean, maximum, minimum, range, standard deviation, missing (null) values, and so on. If you wish to simply the view by removing some of the statistics, you can click the ellipsis button Viewing a statistical summary of vector layers in the lower-right corner of the Statistics Panel and uncheck the statistics you wish to hide from the list.

Instead of viewing statistics for all records in the layer, if you check Selected features only, statistics will only be calculated for the records currently selected (and in cases where nothing is selected, no statistics will appear). As an example, the following screenshot shows statistics for the 64 selected counties in the State of Colorado:

Viewing a statistical summary of vector layers

If you want to make sure that the statistics have been fully calculated, you can click the Recalculate Statistics button Viewing a statistical summary of vector layers to update the statistics. The statistics should keep in sync with the data; however, this button will force a recalculation if you choose to have it do so.

Lastly, you can create an expression to modify field values before the summary statistics are calculated. To create the expression, click the expression editor button Viewing a statistical summary of vector layers to open the Expression dialog. You can create your expression in this dialog to modify the field values in place. The newly calculated values will then be the basis of the summary statistics. An example of use would be to convert a linear length from nautical units to metric units so that the statistics are displayed in metric.

The Statistical Summary tool is quite useful for gaining a quick understanding of a layer's attribute data, or to explore the statistics of the data currently selected. With the ability to get an at-a-glance picture of attribute data, let's now move on to calculating attribute data with advanced expression functions.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.227.69