Creating a map using data that already exists is only the beginning. We have already learned how to edit and add features to OpenStreetMap using JOSM. In this module, we will discuss how to edit existing vector layers in QGIS, and how to create an entirely new dataset.
Before you can add new vector data, you need a vector dataset (a layer) to add it to. In our case, we’ll begin by creating a new data layer, and then we’ll add features to it. First, we must define our dataset.
At this point we must decide what kind of dataset we want to create. Remember that a data layer can only contain features of points, lines or polygons - never a mix. When we create the layer, we must define what type of data it will contain.
Since polygons are made up of points and lines, let’s jump into polygons. Once you’ve mastered this, creating a point or a line layer should be easy!
Your attributes list should now look like this.
The new layer should appear in your Layers panel.
When you create new data, it should represent objects that really exist on the ground. We have already learned of numerous ways to collect data using OSM tools. We learned about GPS to record locations, Field Papers and of course, aerial imagery. These are all tools that we can use to identify real-life locations and record them in a digital data layer.
In QGIS, we can use the same types of sources to get information about the ground. In this example, we will once again turn to aerial imagery, but instead of using Bing, we will use a raster image provided in the tutorial directory.
Digitising, as you might have guessed, is the art (or science) of creating digital vector data from another source, such as a raster image. In order to begin digitising, we must first enter edit mode. GIS software commonly requires a separate mode for editing, to prevent users from accidentally editing or deleting important data. Edit mode is switched on or off individually for each layer.
Let’s enter edit mode for the gedung_kampus layer:
From left to right on the image above, they are:
We want to add a new feature.
You’ll notice that your mouse cursor becomes a crosshair. This allows you to more accurately place the points you’ll be digitising. Remember that even as you’re using the digitising tool, you can zoom in and out on your map by rolling the mouse wheel, and you can pan around by holding down the mouse wheel and dragging around in the map.
The first feature you’ll digitise is a field (called “GSP Field”):
If you make a mistake while digitising a feature, you can always edit it later. Simply finish digitising the feature and then follow these steps:
|Move feature(s) tools||Move the entire feature(s)|
|Node tools||move only one point where you may have misclicked|
|Delete selected||get rid of the feature entirely so you can try again|
|Go to Edit ‣ Undo or press Ctrl+Z on keyboard||Undo mistakes|
Now try it on your own:
When you are finished adding features to a layer, you must save the changes to that layer.
Now you know how to create polygon features! Creating points and line layers is just as easy - you simply need to define the type of layer when you create it, and of course you can only create points in point layers and lines in line layers.
In the previous section we digitised a raster image, thus creating vector data. This is essentially the same process as when we use Bing imagery in JOSM to add to OSM. In both of these cases, the imagery that we use is already georeferenced - that is, it is correctly placed in its proper location.
When an image is georeferenced, it is stretched in different ways so that each pixel in the image corresponds as closely as possible to the area it represents on the spherical Earth. Because it is difficult to perfectly align a flat image on a round object, there are often small georeferencing errors, as we learned previously with imagery offset.
What if you have a map that is not georeferenced? What if you have a paper map given to you by a government agency? How can you digitise it?
The first step is to turn your paper map into a digital image that you can manipulate with your computer. You can do this with a scanner (or possibly a digital camera), although doing so is beyond the scope of this module.
Now we will learn how to georeference an image in QGIS so that is correctly located on Earth. We will be using a map provided in the tutorial files, which looks like this:
In order to georeference this image, we need to associate points on the image, to known points on the Earth. Such points are called ground control points (GCPs). Luckily, this map image has latitude and longitude coordinates written on it at every corner. So, to georeference this image, we will create four GCPs, one at each corner of the map, and we will turn our jpeg file into a geotiff, a georeferenced image.
Lastly we will adjust the settings and then create our output file.
Another way to see that the image is correctly placed, is by adding a layer with the OpenLayers plugin. Here we have added Bing satellite imagery, and made our new geotiff transparent to see Merapi in the background.
Knowing how to georeference is important when you want to digitise from a paper map or an image that is not already georeferenced. Once you have georeferenced an image like this, you can apply the same digitisation techniques that we learned previously in this module to create vector shapefiles that can be used in QGIS and InaSAFE.