Learning Objectives
Up to now, none of the changes we have made to the map have been influenced by the objects that are being shown. In other words, every type of vegetation looks alike, and all the roads look alike. When looking at the map, the viewers don’t know anything about the roads they are seeing; only that there is a road of a certain shape in a certain area.
But the whole strength of GIS is that all the objects that are visible on the map also have attributes. Maps in a GIS aren’t just pictures. They represent not only objects in locations, but also information about those objects. In this lesson we will explore the attribute data of an object and understand what the various data can be useful for.
If you would like to start with the examples used in this module, begin by opening the QGIS project sleman_2_6.qgs.
You now know how to use the attribute table to see what is actually in the data you’re using. A dataset will only be useful to you if it has the attributes that you care about. If you know which attributes you need, you can quickly decide if you’re able to use a given dataset, or if you need to look for another one that has the required attribute data.
Different attributes are useful for different purposes. Some of them can be represented directly as text for the map user to see. Next we’ll see how to use attributes as labels, so that users can see the text on your map.
Labels can be added to a map to show any information about an object. Any vector layer can have labels associated with it. Labels rely on the attribute data of a layer for their content.
There are several ways to add labels in QGIS, but some are better than others. You may notice that when you open the Layer Properties window for a layer, there is a tab called “Labels.” While this tab is designed to put labels on your map, it is not nearly as good as the so-called “Label Tool,” which we will learn in this section. Before being able to access the Label tool, you will need to ensure that it has been activated.
This gives you the Layer labeling settings dialog.
This is good, but as you can see, the labels are overlapping the points that they are associated with. That doesn’t look very nice. The text is also a bit larger than it needs to be. Let’s fix these problems!
Your labels will look like this:
That’s the font problem solved! Now let’s look at the problem of the labels overlapping the points.
Now that you know how labelling works, there’s an additional problem. Points and polygons are easy to label, but what about lines? If you label them the same way as the points, they will look funny. Street name labels, for example, should be parallel to the street lines, not hovering horizontally above them. To make lines behave, we’ll need to edit some options.
The map will look somewhat like this, depending on scale:
It’s good but still not ideal. For starters, some of the names appear more than once, and that’s not always necessary. To prevent that from happening:
Another useful function is to prevent labels being drawn for features too short to be of notice.
As you can see, this hides a lot of the labels that were previously visible, because of the difficulty of making some of them follow twisting street lines and still be legible. You can decide which of these options to use, depending on what you think seems more useful or what looks better.
Now that you know how attributes can make a visual difference for your map, how about using them to change the symbology of objects themselves? That’s the topic for the next section!
Labels are a good way to communicate information such as the names of individual places, but they can’t be used for everything. For example, let’s say that we want to show which district each feature in our vegetation layer is in. Using labels, it would look like this:
Obviously this is not ideal, so we need another solution. That’s what this lesson is about! In this section, we will learn how to classify vector data effectively.
So, this is useful! But it hurts your eyes to look at it, so let’s see what we can do about that.
If you feel confident in your new classification skills, try to classify the residential layer yourself. Use darker colours to distinguish it from vegetation.
In the previous example, we classified the vegetasi layer by what is known as nominal classification. This type of classification is when categories are defined based on names. Next we will classify the pemukiman layer based on the size of each feature. Classifying with attributes that contain only positive numbers, such as land area, is known as ratio classification.
Now you’ll have something like this: