
Counting Hokkaido's Traffic Signals with QGIS
What you'll learn
- How to load OpenStreetMap traffic signal data
- How to count traffic signals using the data
Recommended for
- Anyone who wants to try loading OpenStreetMap data in QGIS
- Anyone who wants to use QGIS to count features by municipality
Introduction
Traffic signals are a familiar sight, but have you ever wondered how many are installed in your own municipality? For many people, signals are simply part of the scenery, and their number rarely comes to mind.
In rural areas, there are far fewer signals than in cities. Some drivers have gone about an hour without stopping at a red light even once.
This article uses QGIS and OpenStreetMap data to count the traffic signals in each municipality of Hokkaido.
Get the data
Get the traffic signal data
First, get the point data for traffic signals. Point data for traffic signals is not published as open data, so this article uses OpenStreetMap.
Use Overpass Turbo, a tool for downloading OpenStreetMap data, to get the traffic signal data for Hokkaido. Copy the following code into the editor and run it. The code defines an area named 北海道 (Hokkaido) and searches for all nodes (traffic signals) in that area that have the tag 'highway'='traffic_signals'.
[out:json][timeout:25];
area["name:ja"="北海道"]->.a;
node(area.a)["highway"="traffic_signals"];
out body;
>;
out skel qt;
After a short wait, the results appear on the map. Once the data loads correctly, click Export at the top of the screen and download it in GeoJSON format.

To learn more about OpenStreetMap, see the following article.
Get the administrative area data
Because the signals are counted by municipality, next download the administrative area data from National Land Numerical Information. This article uses the data for Hokkaido for fiscal year 2025 (Reiwa 7).

Count the traffic signals
Load the traffic signal data
When the data is ready, drag and drop the downloaded traffic signal GeoJSON file into QGIS.

The attribute table shows 9,718 features. This means that OpenStreetMap has 9,718 traffic signals registered in Hokkaido.

According to the Hokkaido Prefectural Police's “Individual Facility Plan for Traffic Safety Facilities,” Hokkaido has about 13,000 traffic signals. This suggests that about 3,000 signals are not yet registered in the OpenStreetMap data.

Load and preprocess the administrative area data
Next, add the administrative area data downloaded from National Land Numerical Information to QGIS.

The attribute table shows 9,555 features. Even within the same municipality, the data has a separate polygon for each ward and each detached area.

This article counts signals by municipality, so dissolve the data by the N03_004 attribute, which holds the municipality name. For the detailed steps of dissolving, see the following article.
After dissolving, the data has 184 features.

Count traffic signals by municipality
Now that the data is ready, count the signals in each municipality. From the Processing Toolbox, open Count points in polygon.

When the Count points in polygon dialog opens, set the following options:
- Polygons: the administrative area layer dissolved above
- Points: the traffic signal layer
- Click the Run button

When the processing finishes, QGIS outputs the administrative area layer with the name Count.
Check the results
Now check the results. Open the attribute table of the output layer. The NUMPOINTS column at the far right holds the counts.
In the attribute table, Sapporo has the most signals in Hokkaido, with 3,179, followed by Asahikawa with 1,042 and Hakodate with 642. As you would expect, municipalities with larger populations tend to have more signals.

Next, narrow the view to the cities of Hokkaido. For how to use filters, see the following article.
The city with the fewest signals is Utashinai with 3, followed by Yubari with 7. These numbers come from OpenStreetMap data, so whether they reflect reality needs to be checked. Still, it was surprising to find so few signals at the city level.

Finally, a choropleth map was created from the counting results.

Conclusion
This article showed how to use OpenStreetMap and QGIS to count traffic signals by municipality in Hokkaido. Analyses of familiar topics based on open data, like this one, are easy for anyone to start. The same method works for features other than traffic signals, so try it with a variety of data.
Data sources


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.


