eyecatch

How to Summarize Values by Polygon in QGIS

Published: Last updated:
This article uses QGIS 3.44.

What you'll learn


  • What you can do with the Join attributes by location (summary) tool in QGIS
  • Specific steps to summarize the attribute values of a target layer for each polygon
  • How to review the summary results clearly

Recommended for


  • Anyone who wants to summarize point or line attribute values for each polygon
  • Anyone who wants statistics by area, such as municipalities or mesh cells
  • Anyone who wants to work more efficiently with QGIS Processing tools

Introduction

When you work with spatial data in QGIS, you often need to summarize the number or values of the features inside an area. For example, you may want to see land price trends by municipality, count facilities in each mesh cell, or get the number of point records in each trade area.

The QGIS Processing tool Join attributes by location (summary) is useful in these cases. This article uses administrative area data to summarize published land prices by municipality, and shows how to get statistics such as the minimum, maximum, and average.

What is Join attributes by location (summary)?

Join attributes by location (summary) summarizes the attribute values of features, such as points or lines, that fall inside a polygon, and adds the result to the polygon as attributes.

For example, from the land price points inside a municipality polygon, you can calculate the count, minimum (min), maximum (max), average, and sum together. The main strength of the tool is that it does more than link features: it joins the attribute values of multiple features that meet a specified spatial relationship while aggregating them, for example as an average or a sum.

Example of Join attributes by location (summary)
Example of Join attributes by location (summary)

To learn the basics of spatial joins and how to use the standard tool, start with the article below.

How to summarize published land prices using administrative area data

This section walks through summarizing the minimum, maximum, and average published land price for each municipality.

1. Add the data

This example uses the Administrative Area Data and the Land Price Publication Data from National Land Numerical Information. Download both datasets and add them to QGIS.

Administrative area and land price publication data added
Administrative area and land price publication data added

2. Combine the administrative area data by municipality

In the attribute table of the administrative area data, the N03_004 column holds the municipality name. However, municipalities with enclaves, for example, can be split into multiple polygons even though they are the same municipality.

The N03_004 column holds the municipality name
The N03_004 column holds the municipality name

If you summarize the data as it is, the results are split by polygon instead of by municipality. First combine the polygons that share a municipality name into one multipolygon.

From the menu bar, choose Geoprocessing Tools → Dissolve.

Choose Geoprocessing Tools → Dissolve from the menu bar
Choose Geoprocessing Tools → Dissolve from the menu bar

For Input layer, select the 行政区域 (administrative areas) layer. For Dissolve field(s), select N03_004 (municipality name). Then click Run.

Dissolve dialog
Dissolve dialog

When the processing finishes, QGIS adds a new layer named Dissolved. To tell it apart from the original layer, rename it to something like 行政区域_融合済 (dissolved administrative areas).

The shapes look almost the same, but polygons with the same municipality name are now merged into one multipolygon, and the number of features drops from 6,904 to 63.

A layer dissolved by municipality is output
A layer dissolved by municipality is output

For more on the Dissolve tool, see the article below.

3. Run Join attributes by location (summary)

With the administrative area layer ready, run the summary next. From the menu bar, open Processing → Toolbox.

Choose Processing → Toolbox from the menu bar
Choose Processing → Toolbox from the menu bar

Enter summary in the search box, then double-click Join attributes by location (summary) in the results.

Start Join attributes by location (summary)
Start Join attributes by location (summary)

When the dialog opens, set the options as follows.

  1. Join to features in: 行政区域_融合済
  2. Where the features: check intersect
  3. By comparing to: 地価公示 (land price publication)
  4. Fields to summarize: check L01_008 (published land price)
  5. Summaries to calculate: leave as is

When you finish, click Run.

Join attributes by location (summary) dialog
Join attributes by location (summary) dialog

When the processing finishes, QGIS adds Joined layer to the Layers panel.

Check the summary results

Open the attribute table. The summary results are in the 7th and later columns.

The summary results are stored in the joined layer
The summary results are stored in the joined layer

To review the results for each municipality more easily, switch to form view by clicking the Switch to form view button at the bottom right. This makes it easier to check all the values for one area together.

Switch to form view with the button at the bottom right
Switch to form view with the button at the bottom right

After you switch to form view, choose Columns → N03_004 (municipality name) from the drop-down at the top left. The list on the left then shows municipality names.

Change the list display to municipality names
Change the list display to municipality names

Select 渋谷区 (Shibuya ward) from the list to check its results. As shown below, it stores various summary results.

  • Number of land price points: 58 (L01_008_count)
  • Minimum price: 952,000 yen (L01_008_min)
  • Maximum price: 35,300,000 yen (L01_008_max)
  • Average price: 6,097,793 yen (L01_008_mean)
Example of the summary results for Shibuya ward
Example of the summary results for Shibuya ward

In this way, Join attributes by location (summary) lets you efficiently summarize data such as published land prices for each polygon, such as administrative areas, and get statistics such as the minimum, maximum, and average all at once. The results are easy to use for understanding land price trends by area and for comparing prices between regions.

Conclusion

This article showed how to use Join attributes by location (summary) in QGIS to summarize the attribute values of features inside polygons.

With this tool, you can go beyond simply overlaying features and efficiently move on to understanding trends and comparing analyses by area. It applies easily to many situations, including price analysis by municipality, counting facilities, and counting features in each mesh cell.

Whenever you want to organize statistics by polygon, try Join attributes by location (summary).

Data used

About the author
QGIS LAB Editorial Team
QGIS LAB Editorial Team

QGIS LAB is a comprehensive information hub for QGIS, the open-source GIS software. Under the concept of “Geospatial for Greater Good,” we share the knowledge and skills to open up the world through location data.