../../../../_images/image710.png

Module 10: Vector Analysis for Problem Solving

Learning Objectives

  • Understand the GIS process
  • Identify addressable problems
  • Understand data needs
  • Start a QGIS project
  • Analyse problems
  • Identify hazard zones
  • Look for important roads
  • Look for medical facilities
  • Buffer roads and medical facilities
  • Analyse overlapped areas

The power of GIS is its ability to help us analyse data. Vector data can be analysed to reveal how different features interact with each other. In this module, we’ll work through the GIS process, attempting to solve a problem, and as we proceed, we will learn about various analysis tools that QGIS provides.

1. The GIS process

Before we start, it will be useful to give a brief overview of a process that can be used to solve any GIS problem. The steps are simple:

  1. State the problem
  2. Get the data
  3. Analyse the problem
  4. Present the results

2. Problem

Let’s start off by deciding on a problem to solve. Imagine that you’re a disaster manager, and you need to provide the best locations to place refugees (IDPs) in villages surrounding Mount Merapi when it erupts. You’ve come up with the following criteria for these locations:

  1. The area should be a dry field or farm in the districts Ngemplak, Turi or Pakem.
  2. The area must be outside of Merapi Eruption Disaster Prone Region III.
  3. Access to the site should be easy, so it will not be more than 300 metres from a main road.
  4. The site should be close to health facilities.
  5. The land area should be between 50000-150000 m².

3. Data

To answer these questions, we’re going to need the following data:

  1. Landuse in Sleman regency
  2. Streets in Sleman
  3. Location of health facilities
  4. KRB Merapi (Merapi Eruption Disaster Prone Region - this is the same data that we learned how to georeference in the previous module)

Note

For this exercise the data has been provided already, but in a real scenario you may need to find providers for the datasets in question. In Indonesia, the National Land Agency and BNPB Bappeda are good sources for the types of data you will need, and OpenStreetMap can be used as a source for roads and infrastructure.

4. Start a project

Now that we know what we want to do, let’s start doing it!

  1. Start a new QGIS project.
../../../../_images/image206.png
  1. Start adding the layers we will use. In the Sleman/Merapi/ folder, add the layers jalan_sleman_49S, tempat_penting_Sleman_49S, KRB3_49S and vegetasi_49S. Your Layers panel should look like this:
../../../../_images/image207.png

Note

Most of the layers are pretty self-explanatory, but what are KRB3, KRB2, and KRB1? These layers show areas of impact when Merapi erupts. KRB3 is the area of worst impact, KRB2 is medium, and KRB1 has little impact. In this scenario we want to find locations that are not within KRB3.

The data we are working with now is similar to that from previous modules, but now it is in a Projected Coordinate System. The previous data was saved in WGS84 - this meant that the coordinates of our features were stored in degrees, which aren’t very good for measuring size or distance. By using a projected system our coordinates are in metres, which is important for analysis, because we can easily measure distances between and around features.

  1. Rename the layers by right-clicking on them and selecting Rename.
  2. Give them the new, simpler names jalan, lokasi_penting, KRB III and vegetasi.
  3. Save your project as merapi_analisis.qgs.
  4. In your operating system’s file manager, create a new folder under qgis/Sleman/Merapi/ and call it evakuasi_bencana.

This is where you’ll save the datasets that we will create during our anaysis.

Now that we’ve got the data, let’s analyse the problem!

5. Analysing the problem: farms and dry fields

The first criteria we’re facing is that the land must be a farm or dry field, and it must be in one of three areas. So let’s tell QGIS to only show us the farms and dry fields that are, in fact, in these sub-districts!

  1. Right-click on the vegetasi layer in the Layers panel.
  2. Click Filter... This opens the Query Builder dialog.
../../../../_images/image208.png
  1. Scroll down in the Fields list on the left of this dialog until you see the field kec. Click on it once.
  2. Click the All button underneath the Values list:
../../../../_images/image209.png

Next we are going to build a query. A query is a statement that allows us to show only the data that we want from a layer. In this case, we want to instruct QGIS to only show us farms and dry fields, that have a sub-district value equal to Ngemplak, Turi, or Pakem.

  1. Double-click kec in the Fields list.
  2. Click the = button (under Operators).
../../../../_images/image210.png
  1. Double-click the value Ngemplak in the Values list.
  2. Click OR.
  3. Repeat these steps twice more, using the values Turi and Pakem instead of Ngemplak. The query should look like this:
../../../../_images/image2111.png
  1. Click AND.
  2. Now highlight guna_lahan in the Fields list, and click the All button to load the values.
  3. Double-click guna_lahan. Then click the = button. Then double-click the value KEBUN.
  4. Click OR.
  5. Repeat the previous step but instead of KEBUN use TEGALAN. Your query should look like this:
../../../../_images/image212.png

The idea is that the query will filter the data layer so that it will only show us the features we want - that is, farms and dry fields in Pakem, Turis and Ngemplak.

  1. We need to add one more thing to our query: parentheses. Without these, our query won’t work quite right. Add two pairs of parentheses on each side of the word AND, like so:
../../../../_images/image213.png
  1. Click OK. The vegetasi layer has far fewer features now.
../../../../_images/image214.png

Well done! We’ve applied our first criteria to begin solving the problem!

6. Danger zone

Our next criteria is that our chosen location should be outside of the danger zone, which is defined by the layer KRB III. For this we can use the Spatial Query tool.

  1. Go to Vector ‣ Spatial Query ‣ Spatial Query.
../../../../_images/image215.png
  1. Under Select source features from choose vegetasi. In the next box choose Is disjoint. The third box should be set to KRB III. The Spatial Query window should look like this:
../../../../_images/image216.png
  1. Click Apply. Then click Close once the selection has been applied.
../../../../_images/image217.png

Now the vegetasi layer looks like the image below. Notice that all the features have been selected that fall outside the KRB III area.

../../../../_images/image218.png

The next steps of our analysis will be easier if we save this selection as a separate layer.

  1. Right-click on the vegetasi layer and click Save As...
../../../../_images/image219.png
  1. Next to the Save as field in the dialog that appears, click the Browse button.
  2. Save the layer under evakuasi_bencana/ as kebun_tegalan.shp.
  3. Check the box labelled Save only selected features and Add saved file to map in the Save vector layer as... dialog.
../../../../_images/image220.png
  1. Click OK.
  2. Rename the layers by right-clicking on new vegetasi layer and selecting Rename. Rename with kebun_tegalan.
  3. Right-click on the old vegetation layer and remove it. You should have these layers remaining:
../../../../_images/image2211.png

7. Finding important roads

We have a problem with our roads layer, similar to that of our vegetation layer. Our roads layer has too many roads! We only want to use main roads for our analysis, so that we can meet the criteria that our location is within 300 metres of a major road. Once again, we will use the Query Builder.

  1. Right-click on the jalan layer and click Filter...
  2. Build a query for the roads layer, like you did above for the vegetation layer You want only primary and secondary roads, so you need to build this query:

“TYPE” = ‘primary’ OR “TYPE” = ‘secondary’

  1. You can use the approach that we learned above, or you can simply type this command into the query box. But be careful that you type it correctly!
../../../../_images/image222.png

8. Looking for health facilities

  1. Using the same approach, build a query for the lokasi_penting layer as shown:

“Fungsi” = ‘Kesehatan’

9. Buffering Roads

Okay, we’ve refined our data a bit so that it shows us the features we are interested in analysing. Remember that according to our criteria our land area should be within 300 metres of a main road and close to a health facility. QGIS allows us to calculate distances from any vector object, and we will use this functionality to help us reach a solution.

  1. Make sure that only the jalan and kebun_tegalan layers are visible, to simplify the map while you’re working.
../../../../_images/image223.png
  1. Go to Vector ‣ Geoprocessing Tools ‣ Buffer(s).
../../../../_images/image224.png
  1. In the first drop-down box select jalan.
  2. Enter 300 next to Buffer distance.
  3. Check the box next to Dissolve buffer results.
  4. Click Browse and type buffer_jalan_300m.shp for the filename.
../../../../_images/image225.png

Note

We input the buffer distance in metres. Good thing we used projected data!

  1. Click OK. QGIS will create a buffer around the streets that extends 300 metres.
  2. When the process finish and buffer_jalan_300m.shp appear in the Layers, you can click Close the Buffer dialog.
../../../../_images/image226.png
  1. Close the Buffer dialog and see your new layer:
../../../../_images/image227.png

Note

Those big fat lines are actually areas that are within 300 metres of primary and secondary roads.

10. Buffering health facilities

  1. Now try it yourself! Using the same approach, create a new buffer layer around your health facilities. The buffer should be 2.5 km in radius.
  2. Don’t forget to check the box Dissolve buffer results so every overlapping buffer will become one feature. Then save the new layer in the same directory as buffer_fas_kesehatan_2.5km.shp. Your resulting map will look something like this:
../../../../_images/image228.png

Note

Remember that the buffer distance is in metres. Keep this in mind when you want to create a 2.5 km buffer!

11. Overlapping areas

Now we can see areas where a main road is 300 metres away and where there is a health facility within 2.5 km. But we only want the areas where both of these criteria are satisfied at once! To do that we will use the Intersect tool.

  1. Go to Vector ‣ Geoprocessing Tools ‣ Intersect.
../../../../_images/image229.png
  1. Enter buffer_fas_kesehatan_2.5km and buffer_jalan_300m as the two input layers. Name the output shapefile intersect_buffer_jalan_kesehatan.shp.
../../../../_images/image230.png
  1. Click OK and add the layer to the project when prompted.

If we hide the original layers, we can see that our new layer shows us the areas where they intersect. These are the areas where both of these criteria are satisfied.

../../../../_images/image2311.png

12. Select farms and dry fields

Now we have the layer kebun_tegalan, which satisfies two of our criteria, and the layer intersect_buffer_jalan_kesehatan.shp, which satisfies two other criteria. We need to know where they overlap!

  1. Go to Vector ‣ Research Tools ‣ Select by location. A dialog will appear.
../../../../_images/image232.png
  1. Set it up like this:
../../../../_images/image233.png
  1. Click OK and you’ll see the results are selected (they are yellow).
../../../../_images/image234.png

Let’s save this selection as a new layer.

  1. Right-click on the kebun_tegalan layer in the Layers panel.
  2. Click Save As....
  3. Name the new file kebun_tegalan_lokasi_terpilih.shp. Then check the box next to Save only selected features and Add saved file to map.
../../../../_images/image235.png

After the process is finish, rename the layers by right-clicking the new kebun_tegalan layer and selecting Rename. Rename with kebun_tegalan_lokasi_terpilih. If we hide all the other layers, we can see the resulting layer:

../../../../_images/image236.png

13. Select land areas of the appropriate size

Hooray! We have now found land areas that meet four of our five criteria. The only remaining criteria is the size of the land. We need to make sure that our possible locations are between 50000-150000 m².

  1. Open the attribute table for the kebun_tegalan_lokasi_terpilih layer. Notice that there is a column named luas_ha. This is the size of the area in hectares. We could use this field to answer our question, but let’s add another column that contains the size of the area in square metres.
  2. Select the kebun_tegalan_lokasi_terpilih layer and open its attribute table:
../../../../_images/image237.png
  1. Enter editing mode by clicking this button:
../../../../_images/image238.png
  1. Click the Start the field calculator button (located in the Attribute Table window).
../../../../_images/image239.png
  1. Check the box next to Create a new field. In the box type luas_m2.
../../../../_images/image240.png
  1. Change Output field type to Decimal number (real). Then click on Geometry and double-click $area.
../../../../_images/image2411.png
  1. Click OK.

You should now see a new column on your attribute table, named luas_m2. And QGIS has filled it in for us with square metres!

../../../../_images/image242.png
  1. Click the edit mode button again, and save your edits.
../../../../_images/image243.png
  1. Close the attribute table. Now we can just do a simple query.
  2. Right-click on the kebun_tegalan_lokasi_terpilih layer and click Filter...
  3. Enter the following:

“luas_m2” >= 50000 AND “luas_m2” <= 150000

../../../../_images/image244.png
  1. Click OK.
../../../../_images/image245.png

That’s it! We have eight pieces of land that meet ALL of our criteria. Any of these pieces of land might be suitable for a location to place refugees.

  1. Right-click the kebun_tegalan_terpilih layer and click Save As. Name the file refugees_location.shp.

Go to next module –>