 Hello, welcome back on my YouTube channel. In today's video I'm going to show how to create a category using a new function in QGIS 3.24. Here you can see the change log, there are a lot of nice new features for cartography. We're going to explore the scale function, which is a new expression function that allows to resize or scale a geometry, so we use it in combination with the geometry generator. We'll apply this to data from the Dutch Health Authority on the vaccination grade in Dutch municipalities. So we download this open data CSV file to further process in QGIS. The link will be provided in the description of this video. Let's import the CSV file in QGIS 3.24. Go to the Data Source Manager, choose the limited text, add the CSV file, and here you see that it uses the semicolon as a delimiter, so we change it and check it up. Preview looks good and you also can see here that we can, in this version of QGIS, declare the data type of the columns. So here we'll not have geometry and I'm going to change the data type of the vaccination coverage to decimal and then I click add and the layer is added now. Because we have data for each municipality in the Netherlands, we need a map with the municipalities. I'm going to install the PDoc Services plugin, which gives access to open data from the Netherlands. If I click this button, I can search for gemeente, which means municipality. It's a WFS, so I can use it as a vector layer, but as you can see it also covers the water bodies, which are included in the municipalities, but the map looks much nicer if we exclude the water. Let's first have a look at the attribute table. We see here that it has a column with municipality codes and we see similar codes here, region code in the CSV file, so we'll use that later to join both layers. But first, let's get rid of the water bodies in the municipalities. One way to do that is to download the vacant layer, which is all the neighborhoods quarters. Let's open the attribute table and there we can see a field, water, yes, no. So I can here do a selection on water equals and then I use an A, which means no in Dutch. Select those features and that looks what I need. So I'm going to export the selected features, create a new deal package for the quarters. Change the name to quarters without water. Click OK and there it is. I'm going to dissolve this layer, so I only have the boundaries and not each quarter. Save it to a geopackage and I call it Netherlands, which means the Netherlands. Basically it's a country map that we're creating and I can use that to clip the municipalities for only the land. That's the next step. Here we have the municipalities, so I'm going to do vector geoprocessing clip. As an input, I choose gemeenten, the municipalities as an overlay the country, the Netherlands and then I save the geopackage and I call the layer gemeenten clip. And now we see our municipalities on the land area. I'm going to join the CSV file with the municipality layer, the clipped one. And as we saw before, it has the identification field, which is common within the CSV region code. Let's verify that. Here region code has the same numbers. Note that the CSV file has the data for different age groups. In the way that we join it, it will only join the data from the age group 12 plus. Layer name is vaccinations and here it is. And I just need to remove some values that are out of range. So there's 9999, there's one feature and there's also features with null and I add that to the selection. It's another feature, so there are two selections now. Let's remove those, save the attribute table and that's our vaccinations layer. Now before we start scaling, it's good to duplicate this layer. So we also have the original surface areas of these municipalities. I also rename it, call it original and let's start styling the vaccinations layer. Go to the layer styling panel and there I go to simple fill and I change this to geometry generator. Now we get a field where we can fill in the code, but we can also go to the editor, which makes it easier to search for functions. And we're going to explore the scale function. It basically needs an x scale factor and a y scale factor. And those factors, we get them from the attribute table and we use the vaccination degree for that, for both x and y. Let's see how it looks and that looks like a mess. It scales them all, but on top of each other and to a much larger size, so that's not exactly what we want. So let's tweak this. First of all, we want each feature independently scaled. So we need to use an array and we use the array for each function. So each polygon will be evaluated. Each element of the array will be evaluated separately. And then we want to generate the series of these polygons for the array and we start from zero and we use the function num geometries, which is the number of geometries in the layer. So the number of polygons and that needs to be done for the geometry itself, for the whole layer. So dollar geometry and some brackets comma, let's write it in a clearer way so we can easily read it. And after doing that independently, it needs to gather them again into one layer. So collect geometries, array for each, generate the series with the number of geometries, scale each one and remember that those polygons were far too big because they have percentages and we need to divide them to 100 to get them in a value scale between zero and one. Close it with some brackets and then we don't see an error in the preview, which means that this expression is correct. Let's see what happens. There it is, let's zoom in. And here we see that it scaled the polygons, the background original has the same color so let's switch it off and here it looks like nice puzzle pieces or the skin of a giraffe and let's have the background with an outline so we can see the original surface areas and let's categorize these classes. Let's use a graduated style for the percentages so we can also see in color how the percentages of vaccinations vary in the area. Let's use this one and then you can play with the class boundaries until you have a result that gives the message that you want to give so we can use an equal interval or natural breaks, pretty breaks, change the number of classes and let's add some labels to see the values. That's just for checking if it makes sense so here we have the labels and that should be the percentage of scaling that we applied and here we see that the work is only 31% of the original area. Let's switch off the labels again and improve the styling a bit so let's do an inverted polygon for the country so we can choose a nice background color. Let's do a light blue and we can change the line of the original polygons to also a blue, let's make it a darker blue and let's do some final tweaks in the colors which I'm going to so manually change and then you can also type the corresponding legend so less than 50 and larger than 85 and that's a nice cartogram of the vaccination degree in the Netherlands. I hope you've enjoyed this video if you like these videos please subscribe to get updates and looking forward to see you again.