In this module, we will learn what is meant by vector data. We will practise adding it to our QGIS projects, and we will learn how to style the data in different ways.
Vector data is the most common type of data found in GIS. A vector is essentially something made up of single points, or lines connecting those points. In other words, points, lines and polygons are all vectors (curved lines are vectors too, but we won’t worry about that for now). We are already quite familiar with vector data because in the previous unit, we used JOSM to create it!
Each object in a vector dataset is referred to as a feature. In JOSM we often refer to them as objects, but in traditional GIS terminology they are features. A polygon that represents a building is a feature, as is a line that represents a river. Each feature has a geographic location and is attached to other data that describe the feature.
One important thing to note is that QGIS layers can only contain one type of feature. That is, one layer can’t contain both point features and line features, because they are different types of data. Hence if you have a file that contains school polygons and another file that contains school points, you would add them as two separate layers.
Almost always, polygon layers will be at the bottom of your layers list, line layers in the middle and point layers at the top. You don’t generally want your polygons overlapping your lines and points.
It’s important to know that the data you will be working with does not only represent where objects are in space, but also tells you what those objects are.
In the project we see the position of Sleman districts, the railway, and some roads, but we can’t see all of the data contained in those layers.
You will see a table with more data about the streets layer. This extra data is called attribute data. The lines that you can see on your map, which represent the location of the streets is called spatial data. Remember in JOSM there was the same division. The points, lines and shapes we draw tell us where, but the tags, or attributes, tell us what. These definitions are commonly used in GIS, so it’s essential to remember them!
You’ve already added vector data to a project in the form of a shapefile. As we mentioned previously, a shapefile is a commonly used geographic file format. It can easily be converted into other formats, and most GIS software can read this type of file. You may notice when adding a shapefile that there are numerous files in your shapefile directory with the same name. This is because a shapefile actually relies on a collection of several other files to store the data and keep various settings. When you add a shapefile to your project, you should always add the one that ends in .shp, but the rest of the files are important too!
Your project should look like this after the new layer has been added:
Shapefiles (and other types of files) are one way to store geographic data. You can also load a vector layer into QGIS from a database. You may already be familiar with Database Management Systems (DBMS) such as Microsoft Access. GIS applications also make use of databases to store geographic data. Databases can be hosted and used locally on your computer, or could be shared between users over a network or the internet.
Remember frequently to save your map! Your QGIS project file does not save the data (data is saved in a shapefile or a database), but it does remember the layers that you have added to the project, their order and any settings that you adjust.
The symbology of a layer is its visual appearance on the map. One of the basic strengths of GIS is that you have a dynamic visual representation of the data you are working with. Therefore, the visual appearance of the map (which depends on the symbology of the individual layers) is very important. The end user of the maps you produce, will need to be able to easily see what the map represents. Equally as important, you need to be able to explore the data as you’re working with it, and good symbology helps a lot.
In other words, having proper symbology is not a luxury or just nice to have. In fact, it’s essential for you to use a GIS properly and produce maps and information that people will understand and be able to use.
To change a layer’s symbology, we will open its properties. Let’s begin by changing the colour of the pemukiman layer.
By default you can also access the Properties menu by double-clicking on the name of the layer.
There’s more to a layer’s symbology than just its colour. Next we want to change the colour of the vegetation, but we also want to eliminate the lines between the different types of vegetation, so as to make the map less visually cluttered.
Next, we want to get rid of the lines between all the farms.
Sometimes you will find that one of your layers is not suitable for a given scale. For example, if you have a layer which shows the earth’s continents but not with very much detail, the continent lines may not be very accurate when you are zoomed in very far.
Scale is a reference to how your map references what is actually on the ground in terms of size. Scale is usually given in terms like 1:10000, which means that one centimetre of length on your map is equal to 10000 centimetres in the real world. When you zoom in or out on a map, the scale changes, as you can see in the status bar at the bottom of QGIS.
In our case, we may decide to hide our streets layer when we are zoomed out very far (a small scale). For example, the streets layer is not very useful when we are zoomed out far and it looks like a blob.
Let’s enable scale-based rendering:
You can use your mouse wheel to zoom in increments. Alternatively, use the zoom tools to draw a box and zoom to it:
Now that we know how to change simple symbology for layers, the next step is to create more complex symbology. QGIS allows us to do this using symbol layers.
The symbol layers may appear different in colour, but don’t worry, we’re going to customise it anyway.
Now this layer has two different symbologies. In other words, both the blue colour AND the green colour will be drawn. However, the green colour will be drawn above the blue, and since it is a solid colour, it will completely hide the blue colour. Let’s change it.
It’s important not to get confused between a map layer and a symbol layer. A map layer is a vector (or raster) that has been loaded into the map. A symbol layer is only the symbology used to represent a map layer. This course will usually refer to a map layer as just a layer, but a symbol layer will always be called a symbol layer, to prevent confusion.
Now try it yourself. Add an additional symbology layer to the Jalan_Sleman_OSM layer.
This will result in your roads looking something like this:
Your map will now look like this:
Symbol levels also work for classified layers (i.e., layers having multiple symbols). We will cover classification in the next module, but you can see how it works here with roads. By classifying various streets according to their type, we can give them different symbologies and they will still appear to flow into each other.
In addition to setting fill colours and using predefined patterns, you can use different symbol layer types entirely. The only type we’ve been using up to now was the Simple Fill type. The more advanced symbol layer types allow you to customise your symbols even further.
Each type of vector (point, line and polygon) has its own set of symbol layer types.
Once you have applied the style, take a look at its results on the map. As you can see, these symbols change direction along with the road but don’t always bend along with it. This is useful for some purposes, but not for others. If you prefer, you can change the symbol layer in question back to the way it was before.
The symbol properties should look like this:
As a result, you have a textured symbol for the urban layer, with the added benefit that you can change the size, shape and distance of the individual dots that make up the texture.