GIS Animal Health:Bahasa Indonesia: Perbedaan revisi

(Created page with "[index::doc] = Foreword = [foreword/foreword:foreword][foreword/foreword:course-introduction] == About this course == This course has adopted and modified an existing QGIS...")
 
 
(5 revisi antara oleh pengguna yang sama tidak ditampilkan)
Baris 1: Baris 1:
[index::doc]
+
=GIS untuk Kesahaten Hewan=
  
= Foreword =
+
==Modul-modul==
 +
[[GIS AH IND: Kata Pengantar|Kata Pengantar]]
  
[foreword/foreword:foreword][foreword/foreword:course-introduction]
+
[[GIS AH IND M2|Modul 2: Antarmuka]]
  
== About this course ==
+
[[GIS AH IND M3|Modul 3: Membuat Peta Sederhana]]
  
This course has adopted and modified an existing QGIS course developed by Linfiniti Consulting CC. We have adopted their exercises using Indonesian data. We have also created a new chapter showing you how to use these skills and apply them to animal health problems using data from the new Indonesian animal health information system, iSIKHNAS.
+
[[GIS AH IND M4|Modul 4: Mengklasifikasi Data Vektor]]
  
The original manual was created using QGIS 1.8, and we have continued with this version for this manual. The original manual, which includes more advanced exercises, is available here: http://www.qgis.org/en/docs/index.html
+
[[GIS AH IND M5|Modul 5: Membuat Peta]]
  
Below is Linfiniti Consulting CC.’s original Background and Foreword to the manual.
+
[[GIS AH IND M6|Modul 6: Membuat Data Vektor]]
  
== Background ==
+
[[GIS AH IND M7|Modul 7: Analisis Vektor]]
  
In 2008 we launched the [http://linfiniti.com/dla Gentle Introduction to GIS]<ref>http://linfiniti.com/dla
+
[[GIS AH IND M8|Modul 8: Plugin]]
</ref>, a completely free, open content resource for people who want to learn about GIS without being overloaded with jargon and new terminology. It was sponsored by the South African government and has been a phenomenal success, with people all over the world writing to us to tell us how they are using the materials to run University Training Courses, teach themselves GIS and so on. The Gentle Introduction is not a software tutorial, but rather aims to be a generic text (although we used QGIS in all examples) for someone learning about GIS. There is also the QGIS manual which provides a detailed functional overview of the QGIS application. However, it is not structured as a tutorial, but rather as a reference guide. At Linfiniti Consulting CC. we frequently run training courses and have realised that a third resource is needed - one that leads the reader sequentially through learning the key aspects of QGIS in a trainer-trainee format - which prompted us to produce this work.
 
  
This training manual is intended to provide all the materials needed to run a 5 day course on QGIS, PostgreSQL and PostGIS. The course is structured with content to suit novice, intermediate and advanced users alike and has many exercises complete with annotated answers throughout the text.
+
[[GIS AH IND M9|Modul 9: GIS untuk Kesahaten Hewan]]
  
== License ==
+
[[GIS AH Answers|''Answer sheet for GIS for Animal Health'']]
  
[[Image:license.png|image]]
+
==Versi lengkap==
 
+
[[GIS AH IND: Complete|'''GIS untuk Kesahaten Hewan : Versi lengkap''']]
The Free Quantum GIS Training Manual by Linfiniti Consulting CC. is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. Based on a work at https://github.com/qgis/QGIS-Training-Manual. Permissions beyond the scope of this license may be available at https://github.com/qgis/QGIS-Training-Manual/blob/master/index.rst.
 
 
 
We have published this QGIS training manual under a liberal license that allows you to freely copy, modify and redistribute this work. A complete copy of the license is available at the end of this document. In simple terms, the usage guidelines are as follows:
 
 
 
* You may not represent this work as your own work, or remove any authorship text or credits from this work.
 
* You may not redistribute this work under more restrictive permissions than those under which it was provided to you.
 
* If you add a substantitive portion to the work and contribute it back to the project (at least one complete module) you may add your name to the end of the authors list for this document (which will appear on the front page)
 
* If you contribute minor changes and corrections you may add yourself to the contributors list below.
 
* If you translate this document in its entirety, you may add your name to the authors list in the form “Translated by Joe Blogs”.
 
* If you sponsor a module or lesson, you may request the author to include an acknowledgement in the beginning of each lesson contributed, e.g.:
 
 
 
<span>note</span><span>Note:</span> This lesson was sponsored by MegaCorp.
 
 
 
* If you are unsure about what you may do under this license, please contact us at [mailto:office@linfiniti.com office@linfiniti.com]<ref>office@linfiniti.com</ref> and we will advise you if what you intend doing is acceptable.
 
* If you publish this work under a self publishing site such as http:://lulu.com we request that you donate the profits to the QGIS project.
 
* You may not commercialise this work, except with the expressed permission of the authors. To be clear, by commercialisation we mean that you may not sell for profit, create commercial derivative works (e.g. selling content for use as articles in a magazine). The exception to this is if all the profits are given to the QGIS project. You may (and we encourage you to do so) use this work as a text book when conducting training courses, even if the course itself is commercial in nature. In other words, you are welcome to make money by running a training course that uses this work as a text book, but you may not profit off the sales of the book itself - all such profits should be contributed back to QGIS.
 
 
 
== Sponsoring Chapters ==
 
 
 
This work is by no means a complete treatise on all the things you can do with QGIS and we encourage others to add new materials to fill any gaps. Linfiniti Consulting CC. can also create additional materials for you as a commercial service, with the understanding that all such works produced should become part of the core content and be published under the same license.
 
 
 
== Authors ==
 
 
 
* Rüdiger Thiede ([mailto:rudi@linfiniti.com rudi@linfiniti.com]<ref>rudi@linfiniti.com</ref>) - Rudi has written the QGIS instructional materials and parts of the PostGIS materials.
 
* Tim Sutton ([mailto:tim@linfiniti.com tim@linfiniti.com]<ref>tim@linfiniti.com</ref>) - Tim has overseen and guided the project and co-authored the PostgreSQL and PostGIS parts. Tim also authored the custom sphinx theme used for this manual.
 
* Horst Düster ([mailto:horst.duester@kappasys.ch horst.duester@kappasys.ch]<ref>horst.duester@kappasys.ch</ref> ) - Horst co-authored the PostgreSQL and PostGIS parts
 
* Marcelle Sutton ([mailto:marcelle@linfiniti.com marcelle@linfiniti.com]<ref>marcelle@linfiniti.com</ref>) - Marcelle provided proof reading and editorial advice during the creation of this work.
 
 
 
== Individual Contributors ==
 
 
 
Your name here!
 
 
 
== Sponsors ==
 
 
 
* Cape Peninsula University of Technology
 
 
 
== Data ==
 
 
 
The sample data that accompanies this resource is freely available and comes from the following sources:
 
 
 
* Streets and Places datasets from OpenStreetMap (http://www.openstreetmap.org/)
 
* Property boundaries (urban and rural), water bodies from NGI (http://www.ngi.gov.za/)
 
* SRTM DEM from the CGIAR-CGI (http://srtm.csi.cgiar.org/)
 
 
 
== Latest Version ==
 
 
 
You can always obtain the latest version of this document by visiting our [http://readthedocs.org/builds/the-free-qgis-training-manual/ home page]<ref>http://readthedocs.org/builds/the-free-qgis-training-manual/
 
</ref> which is kindly hosted by http://readthedocs.org.
 
 
 
<span>note</span><span>Note:</span> There are links to PDF and epub versions of the documentation in the lower right hand corner of the above mentioned home page.
 
 
 
Tim Sutton, May 2012
 
 
 
= Module: The Interface =
 
 
 
[introduction/index:mod-the-interface]
 
 
 
== Lesson: A Brief Introduction ==
 
 
 
[introduction/intro::doc] Welcome to this course! We are going to show you how to use QGIS easily and efficiently. If you’re new to GIS, we’ll tell you what you need to get started. If you’re an experienced user, you’ll see how QGIS fulfills all the functions you expect from a GIS program, and more!
 
 
 
In this module we introduce the QGIS project itself, as well as explaining the user interface.
 
 
 
After completing this section, you will be able to correctly identify the main elements of the screen in QGIS and know what each of them does, and load a shapefile into QGIS.
 
 
 
<span>warning</span><span>Warning:</span> This course includes instructions on adding, deleting and altering GIS datasets. We have provided training datasets for this purpose. Before using the techniques described here on your own data, always ensure you have proper backups!
 
 
 
=== How to use this tutorial ===
 
 
 
Any text ''that looks like this'' refers to something on the screen that you can click on.
 
 
 
Text that ''looks <math>\rightarrow</math> like <math>\rightarrow</math> this'' directs you through menus.
 
 
 
<span><code>This kind of text</code></span> refers to something you can type, such as a command, path, or file name.
 
 
 
=== Tiered course objectives ===
 
 
 
This course caters to different user experience levels. Depending on which category you consider yourself to be in, you can expect a different set of course outcomes. Each category contains information that is essential for the next one, so it’s important to do all exercises that are at or below your level of experience.
 
 
 
==== [[Image:basic9.png|image]] Basic ====
 
 
 
In this category, the course assumes that you have little or no prior experience with theoretical GIS knowledge or the operation of a GIS program.
 
 
 
Limited theoretical background will be provided to explain the purpose of an action you will be performing in the program, but the emphasis is on learning by doing.
 
 
 
When you complete the course, you will have a better concept of the possibilities of GIS, and how to harness their power via QGIS.
 
 
 
==== [[Image:moderate9.png|image]] Intermediate ====
 
 
 
In this category, it is assumed that you have working knowledge and experience of the everyday uses of GIS.
 
 
 
Following the instructions for the beginner level will provide you with familiar ground, as well as to make you aware of the cases where QGIS does things slightly differently from other software you may be used to. You will also learn how to use analysis functions in QGIS.
 
 
 
When you complete the course, you should be comfortable with using QGIS for all of the functions you usually need from a GIS for everyday use.
 
 
 
==== [[Image:hard9.png|image]] Advanced ====
 
 
 
In this category, the assumption is that you are experienced with GIS, have knowledge of and experience with spatial databases, using data on a remote server, perhaps writing scripts for analysis purposes, etc.
 
 
 
Following the instructions for the other two levels will familiarize you with the approach that the QGIS interface follows, and will ensure that you know how to access the basic functions that you need. You will also be shown how to make use of QGIS’ plugin system, database access system, and so on.
 
 
 
When you complete the course, you should be well-acquainted with the everyday operation of QGIS, as well as its more advanced functions.
 
 
 
=== Why QGIS? ===
 
 
 
As information becomes increasingly spatially aware, there is no shortage of tools able to fulfill some or all commonly used GIS functions. Why should anyone be using QGIS over some other GIS software package?
 
 
 
Here are only some of the reasons:
 
 
 
* ''It’s free, as in lunch.'' Installing and using the QGIS program costs you a grand total of zero money. No initial fee, no recurring fee, nothing.
 
* ''It’s free, as in liberty.'' If you need extra functionality in QGIS, you can do more than just hope it will be included in the next release. You can sponsor the development of a feature, or add it yourself if you are familiar with programming.
 
* ''It’s constantly developing.'' Because anyone can add new features and improve on existing ones, QGIS never stagnates. The development of a new tool can happen as quickly as you need it to.
 
* ''Extensive help and documentation is available.'' If you’re stuck with anything, you can turn to the extensive documentation, your fellow QGIS users, or even the developers.
 
* ''Cross-platform.'' QGIS can be installed on MacOS, Windows and Linux.
 
 
 
Now that you know why you want to use QGIS, we can show you how. The first lesson will guide you in creating your first QGIS map.
 
 
 
== Lesson: Adding your first layer ==
 
 
 
[introduction/preparation::doc] We will start the application, and create a basic map to use for examples and exercises.
 
 
 
'''The goal for this lesson:''' To get started with an example map.
 
 
 
<span>note</span><span>Note:</span> Before starting this exercise, QGIS must be installed on your computer.
 
 
 
Launch QGIS from its desktop shortcut, menu item, etc., depending on how you configured its installation.
 
 
 
<span>note</span><span>Note:</span> The screenshots for this course were taken in QGIS 1.8 running on Mac OS X 10.9.5. Depending on your setup, the screens you encounter may well appear somewhat different. However, all the same buttons will still be available, and the instructions will work on any OS. You will need QGIS 1.8 or above to use this course.
 
 
 
Let’s get started right away!
 
 
 
=== [[Image:basic9.png|image]] Follow along: Prepare a map ===
 
 
 
[introduction/preparation:backlink-interface-preparation-1]
 
 
 
* Open QGIS. You will have a new, blank map.
 
* Look for the ''Add Vector Layer'' button:
 
 
 
<span>[[Image:0024.png|image]]</span>
 
 
 
* Click on it to open the following dialog:
 
 
 
<span>[[Image:0034.png|image]]</span>
 
 
 
* Click on the ''Browse'' button and navigate to the file <span><code>exercise_data/streets.shp</code></span> (in your course directory). With this file selected, click ''Open''. You will see the original dialog, but with the file path filled in. Click ''Open'' here as well. The data you specified will now load.
 
 
 
Congratulations! You now have a basic map. Now would be a good time to save your work.
 
 
 
* Click on the ''Save As'' button:
 
 
 
<span>[[Image:0045.png|image]]</span>
 
 
 
* Save the map under <span><code>exercise_data/</code></span> and call it <span><code>basic_map.qgs</code></span>.
 
 
 
=== In conclusion ===
 
 
 
You’ve learned how to add a layer and create a basic map!
 
 
 
=== What’s next? ===
 
 
 
Now you’re familiar with the function of the ''Add Vector Layer'' button, but what about all the others? How does this interface work? Before we go on with the more involved stuff, let’s first take a good look at the general layout of the QGIS interface. This is the topic of the next lesson.
 
 
 
== Lesson: An Overview of the Interface ==
 
 
 
[introduction/overview::doc] We will explore the QGIS user interface so that you are familiar with the menus, toolbars, map canvas and layers list that form the basic structure of the interface.
 
 
 
'''The goal for this lesson:''' To understand the basics of the QGIS user interface.
 
 
 
=== [[Image:basic9.png|image]] Try yourself...: The Basics ===
 
 
 
<span>[[Image:001-diagram.png|image]]</span>
 
 
 
The elements identified in the figure above are:
 
 
 
# Layers list
 
# Toolbars
 
# Map canvas
 
# Status bar
 
 
 
==== [[Image:basic9.png|image]] The Layers List ====
 
 
 
In the Layers list, you can see a list, at any time, of all the layers available to you.
 
 
 
Expanding collapsed items (by clicking the arrow or plus symbol beside them) will provide you with more information on the layer’s current appearance.
 
 
 
Right-clicking on a layer will give you a menu with lots of extra options. You will be using some of them before long, so take a look around!
 
 
 
Some versions of QGIS have a separate ''Control rendering order'' checkbox just underneath the Layers list. Don’t worry if you can’t see it. If it is present, ensure that it’s checked for now.
 
 
 
<span>note</span><span>Note:</span> A vector layer is a dataset, usually of a specific kind of object, such as roads, trees, etc. A vector layer can consist of either points, lines or polygons.
 
 
 
==== [[Image:basic9.png|image]] Toolbars ====
 
 
 
Your most oft-used sets of tools can be turned into toolbars for basic access. For example, the File toolbar allows you to save, load, print, and start a new project. You can easily customize the interface to see only the tools you use most often, adding or removing toolbars as necessary via the ''View <math>\rightarrow</math> Toolbars'' menu.
 
 
 
Even if they are not visible in a toolbar, all of your tools will remain accessible via the menus. For example, if you remove the ''File'' toolbar (which contains the ''Save'' button), you can still save your map by clicking on the ''File'' menu and then clicking on ''Save''.
 
 
 
==== [[Image:basic9.png|image]] The Map Canvas ====
 
 
 
This is where the map itself is displayed.
 
 
 
==== [[Image:basic9.png|image]] The Status Bar ====
 
 
 
Shows you information about the current map. Also allows you to adjust the map scale and see the mouse cursor’s coordinates on the map.
 
 
 
=== [[Image:basic9.png|image]] Try yourself... 1 ===
 
 
 
[introduction/overview:backlink-interface-overview-1] Try to identify the four elements listed above on your own screen, without referring to the diagram above. See if you can identify their names and functions. You will become more familiar with these elements as you use them in the coming days.
 
 
 
=== [[Image:basic9.png|image]] Try yourself... 2 ===
 
 
 
[introduction/overview:basic-ty-2] Try to find each of these tools on your screen. What is their purpose?
 
 
 
# <span>[[Image:0045.png|image]]</span>
 
# <span>[[Image:0054.png|image]]</span>
 
# <span>[[Image:0063.png|image]]</span>
 
# <span>[[Image:0074.png|image]]</span>
 
# <span>[[Image:0083.png|image]]</span>
 
 
 
<span>hint</span><span>Hint:</span> If any of these tools is not visible on the screen, try enabling some toolbars that are currently hidden. Also keep in mind that if there isn’t enough space on the screen, a toolbar may be shortened by hiding some of its tools. You can see the hidden tools by clicking on the double right arrow button in any such collapsed toolbar. You can see a tooltip with the name of any tool by holding your mouse over the tool for a while.
 
 
 
=== What’s next? ===
 
 
 
Now you’ve seen how the QGIS interface works, you can use the tools available to you and start improving on your map! This is the topic of the next lesson.
 
 
 
= Module: Creating a Basic Map =
 
 
 
[basic<sub>m</sub>ap/index:mod-creating-a-basic-map] In this module, you will create a basic map which will be used later as a basis for further demonstrations of QGIS functionality.
 
 
 
== Lesson: Working with Vector Data ==
 
 
 
[basic<sub>m</sub>ap/vector<sub>d</sub>ata::doc] Vector data is arguably the most common kind of data you will find in the daily use of GIS. It describes geographic data in terms of points, that may be connected into lines and polygons. Every object in a vector dataset is called a '''feature''', and is associated with data that describes that feature.
 
 
 
'''The goal for this lesson:''' To learn about the structure of vector data, and how to load vector datasets into a map.
 
 
 
=== [[Image:basic4.png|image]] Follow along: Viewing layer attributes ===
 
 
 
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.
 
 
 
From the previous exercise, you should have the ''streets'' layer loaded in your map. What you can see right now is merely the position of the roads.
 
 
 
To see all the data available to you:
 
 
 
* Click on this button:
 
 
 
<span>[[Image:0041.png|image]]</span>
 
 
 
It will show you 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 represent where the streets go; this is the ''spatial data''.
 
 
 
These definitions are commonly used in GIS, so it’s essential to remember them!
 
 
 
* You may now close the attribute table.
 
 
 
Vector data represents features in terms of points, lines and polygons on a coordinate plane. It is usually used to store discrete features, like roads and city blocks.
 
 
 
=== [[Image:basic4.png|image]] Follow along: Loading vector data from shapefiles ===
 
 
 
[basic<sub>m</sub>ap/vector<sub>d</sub>ata:backlink-vector-load-shapefiles-1] The Shapefile is a specific file format that allows you to store GIS data in an associated group of files. Each layer consists of several files with the same name, but different file types. Shapefiles are easy to send back and forth, and most GIS software can read them.
 
 
 
Refer back to the introductory exercise in the previous section for instructions on how to add vector layers.
 
 
 
* Load the “waterways”, “places” and “forests” datasets into your map following the same method.
 
 
 
=== [[Image:basic4.png|image]] Follow along: Loading vector data from a database ===
 
 
 
[basic<sub>m</sub>ap/vector<sub>d</sub>ata:backlink-vector-load-from-database-1] Databases allow you to store a large volume of associated data in one file. You may already be familiar with a database management system (DBMS) such as Microsoft Access. GIS applications can also make use of databases. GIS-specific DBMSes (such as PostGIS) have extra functions, because they need to handle spatial data.
 
 
 
* Click on this icon:
 
 
 
<span>[[Image:0051.png|image]]</span>
 
 
 
(If you’re sure you can’t see it at all, check that the ''Manage Layers'' toolbar is enabled.)
 
 
 
It will give you a new dialog. In this dialog:
 
 
 
* Click the ''New'' button.
 
* In the same folder as the other data, you should find the file ''land_use.sqlite''. Select it and click ''Open''.
 
 
 
You will now see the first dialog again. Notice that the dropdown select above the three buttons now reads “land_use.sqlite@...”, followed by the path of the database file on your computer.
 
 
 
* Click the ''Connect'' button. You should see this in the previously empty box:
 
 
 
<span>[[Image:0071.png|image]]</span>
 
 
 
* Click on the layer to select it
 
* Click ''Add''
 
 
 
<span>note</span><span>Note:</span> Remember to save the map often! The map file doesn’t contain any of the data directly, but it remembers which layers you loaded into your map.
 
 
 
=== Follow along: Reordering the layers ===
 
 
 
The layers in your Layers list are drawn on the map in a certain order. The layer at the bottom of the list is drawn first, and the layer at the top is drawn last. By changing the order that they are shown on the list, you can change the order they are drawn in.
 
 
 
<span>note</span><span>Note:</span> Depending on the version of QGIS that you are using, you may have a checkbox beneath your Layers list reading ''Control rendering order''. This must be checked (switched on) so that moving the layers up and down in the Layers list will bring them to the front or send them to the back in the map. If your version of QGIS doesn’t have this option, then it is switched on by default and you don’t need to worry about it.
 
 
 
The order in which the layers have been loaded into the map is probably not logical at this stage.
 
 
 
For example, this layer order...
 
 
 
<span>[[Image:0021.png|image]]</span>
 
 
 
... would result in some places being hidden as they run ''underneath'' the land_use areas.
 
 
 
To resolve this problem:
 
 
 
* Click and drag on a layer in the Layers list.
 
* Reorder them to look like this:
 
 
 
<span>[[Image:0031.png|image]]</span>
 
 
 
=== In conclusion ===
 
 
 
Now you’ve added all the layers you need from several different sources.
 
 
 
=== What’s next? ===
 
 
 
Using the random palette automatically assigned when loading the layers, your current map is probably not easy to read. It would be preferable to assign your own choice of colors and symbols. This is what you’ll learn to do in the next lesson.
 
 
 
== Lesson: Symbology ==
 
 
 
[basic<sub>m</sub>ap/symbology:ls-symbology] The symbology of a layer is its visual appearance on the map. The basic strength of GIS over other ways of representing data with spatial aspects is that with GIS, you have a dynamic visual representation of the data you’re 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 be able to use.
 
 
 
'''The goal for this lesson:''' To create different symbology for any vector layer.
 
 
 
=== [[Image:basic4.png|image]] Follow along: Changing colors ===
 
 
 
To change a layer’s symbology, open its ''Layer Properties''. Let’s begin by changing the color of the ''waterways'' layer.
 
 
 
* Right-click on the ''waterways'' layer in the Layers list.
 
* Select the menu item ''Properties'' in the menu that appears.
 
 
 
<span>note</span><span>Note:</span> By default, you can also access a layer’s properties by double-clicking on the layer in the Layers list.
 
 
 
In the ''Properties'' window:
 
 
 
* Select the ''Style'' tab at the extreme left:
 
 
 
<span>[[Image:052.png|image]]</span>
 
 
 
* Click the ''Change'' button next to the ''Color'' label.
 
 
 
A standard color dialog will appear.
 
 
 
* Choose a blue color and click ''OK''.
 
* Click ''OK'' again in the ''Layer Properties'' window, and you will see the color change being applied to the layer.
 
 
 
<span>[[Image:0191.png|image]]</span>
 
 
 
=== [[Image:basic4.png|image]] Try yourself... ===
 
 
 
[basic<sub>m</sub>ap/symbology:basic-ty] Change the ''forest'' layer to a new color that you associate with forests.
 
 
 
=== [[Image:basic4.png|image]] Follow along: Changing symbol structure ===
 
 
 
This is a good introduction, but there is more to a layer’s symbology than just its color. To learn about some of the other options available, add the layer ''bandung_districts''. This layer has been made up of images originally taken by satellite, and showing various types of land cover in the area around Bandung.
 
 
 
Using this layer we can learn how to remove the lines so the map does not appear cluttered.
 
 
 
* Open the ''Layer Properties'' window for the ''bandung_districts'' layer.
 
 
 
Under the ''Style'' tab, you will see the same kind of dialog as before. This time, however, you’re doing more than just quickly changing the color.
 
 
 
* Click on the ''Change...'' button below the color display:
 
 
 
<span>[[Image:053.png|image]]</span>
 
 
 
The ''Symbol properties'' dialog will appear.
 
 
 
* Change the color inside the polygons in the layer by clicking the button next to the ''Color'' label (if you haven’t done so already during the previous lesson).
 
* In the dialog that appears, choose a new color.
 
* Click ''OK'', but only once.
 
 
 
Next, we want to get rid of the lines between the different types of land cover.
 
 
 
* Click on the ''Border style'' dropdown. At the moment, it should be showing a short line and the words ''Solid Line''.
 
* Change this to ''No Pen''.
 
* Click ''OK'', and then ''OK'' again.
 
 
 
Now the ''bandung_districts'' layer won’t have any lines between the different areas of land cover.
 
 
 
=== [[Image:basic4.png|image]] Try yourself... ===
 
 
 
[basic<sub>m</sub>ap/symbology:id1]
 
 
 
* Change the ''bandung_districts'' layer again so that it has dotted outlines which are just a bit darker than the fill color for that layer.
 
 
 
=== [[Image:moderate4.png|image]] Follow along: Scale-based visibility ===
 
 
 
Sometimes you will find that a layer is not suitable for a given scale. For example, a dataset of all the continents may have low detail, and not be very accurate at street level. When that happens, you want to be able to hide the dataset at inappropriate scales.
 
 
 
In our case, we may decide to hide the streets from view at small scales. This map, for example ...
 
 
 
<span>[[Image:049.png|image]]</span>
 
 
 
... is not very useful. The streets are just a blob at that scale.
 
 
 
To enable scale-based rendering:
 
 
 
* Open the ''Layer Properties'' dialog for the ''streets'' layer.
 
* Activate the ''General'' tab.
 
* Enable scale-based rendering by clicking on the checkbox labeled ''Use scale dependent rendering'':
 
 
 
<span>[[Image:050.png|image]]</span>
 
 
 
* Change the ''Maximum'' value to <span><code>100000</code></span>.
 
* Click ''OK''.
 
 
 
Test the effects of this by zooming in and out in your map, noting when the ''streets'' layer disappears and reappears.
 
 
 
<span>note</span><span>Note:</span> You can use your mouse wheel to zoom in increments. Alternatively, use the zoom tools to zoom to a window:
 
 
 
<span>[[Image:051.png|image]]</span>
 
 
 
=== [[Image:moderate4.png|image]] Follow along: Adding symbol layers ===
 
 
 
Now that you know how to change simple symbology for layers, the next step is to create more complex symbology. QGIS allows you to do this using symbol layers.
 
 
 
* Go back to the ''bandung_districts'' layer’s ''Symbol properties'' dialog as before.
 
 
 
In this example, the current symbol has a dotted outline (i.e., it uses the ''Dot Line'' border style).
 
 
 
<span>[[Image:054.png|image]]</span>
 
 
 
Note the highlighted button.
 
 
 
* Click on it and the dialog will change to look somewhat like this:
 
 
 
<span>[[Image:0102.png|image]]</span>
 
 
 
(It may appear somewhat different in color, for example, but you’re going to change that anyway.)
 
 
 
Now there’s a second symbol layer. Being a solid color, it will of course completely hide the previous kind of symbol. Plus, it has a ''Solid Line'' border style, which we don’t want. Clearly this symbol has to be changed.
 
 
 
<span>note</span><span>Note:</span> 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 part of the symbol 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.
 
 
 
* Set the border styles to ''No Pen''.
 
* Change the fill style to something other than ''Solid'' or ''No brush''. For example:
 
 
 
<span>[[Image:0111.png|image]]</span>
 
 
 
* Click ''OK'' in this dialog and ''Apply'' in the one after that. Now you can see your results and tweak them as needed.
 
 
 
You can even add multiple extra symbol layers and create a kind of texture for your layer that way.
 
 
 
<span>[[Image:0121.png|image]]</span>
 
 
 
It’s fun! But it probably has too many colors to use in a real map...
 
 
 
=== [[Image:moderate4.png|image]] Try yourself... ===
 
 
 
[basic<sub>m</sub>ap/symbology:backlink-symbology-layers-1]
 
 
 
* Create a simple, but not distracting texture for the ''forest'' layer using the methods above.
 
 
 
=== [[Image:moderate4.png|image]] Follow along: Enabling symbol levels ===
 
 
 
When symbol layers are rendered, they are also rendered in a sequence, similar to how the different map layers are rendered. This means that in some cases, having many symbol layers in one symbol can cause unexpected results.
 
 
 
* Give the ''streets'' layer an extra symbol layer (using the method for adding symbol layers demonstrated above).
 
* Give the base line a thickness of <span><code>0.5</code></span>.
 
* Give the top layer a thickness of <span><code>2.0</code></span>.
 
 
 
You’ll notice that this happens:
 
 
 
<span>[[Image:0141.png|image]]</span>
 
 
 
Well that’s not what we want at all!
 
 
 
To prevent this from happening, you can enable symbol levels, which will control the order in which the different symbol layers are rendered.
 
 
 
* In the ''Layer Properties'' dialog, click on ''Advanced <math>\rightarrow</math> Symbol levels'':
 
 
 
<span>[[Image:055.png|image]]</span>
 
 
 
The ''Symbol Levels'' dialog will appear.
 
 
 
* Alter its values to match this example:
 
 
 
<span>[[Image:0162.png|image]]</span>
 
 
 
* Click ''OK'', then ''OK'' again.
 
 
 
The map will now look like this:
 
 
 
<span>[[Image:0172.png|image]]</span>
 
 
 
When you’re done, remember to save the symbol itself so as not to lose your work if you change the symbol again in the future. You can save your current symbol style by clicking the ''Save Style ...'' button under the ''Style'' tab of the ''Layer Properties'' dialog. Save your style under <span><code>exercise_data/styles</code></span>. You can load a previously saved style at any time by clicking the ''Load Style ...'' button. Before you change a style, keep in mind that any unsaved style you are replacing will be lost.
 
 
 
=== [[Image:moderate4.png|image]] Try yourself... ===
 
 
 
[basic<sub>m</sub>ap/symbology:id2]
 
 
 
* Change the appearance of the ''streets'' layer again.
 
 
 
The roads must be dark gray or black, with a thin yellow outline, and a dashed white line running in the middle to make them resemble a real road.
 
 
 
<span>[[Image:0273.png|image]]</span>
 
 
 
=== [[Image:hard4.png|image]] Try yourself... ===
 
 
 
[basic<sub>m</sub>ap/symbology:hard-ty] Symbol levels also work for classified layers (i.e., layers having multiple symbols). Since we haven’t covered classification yet, you will work with some rudimentary preclassified data.
 
 
 
* Create a new map and add only the ''streets'' dataset.
 
* Apply the style <span><code>advanced_street_style_demo.qml</code></span> provided in <span><code>exercise_data/styles</code></span>.
 
* Zoom into the layer so it is easier to see.
 
* Using symbol layers, ensure that the outlines of layers flow into one another as per the image below:
 
 
 
<span>[[Image:0252.png|image]]</span>
 
 
 
=== [[Image:moderate4.png|image]] Follow along: Symbol layer types ===
 
 
 
To continue with the exercise, open your original map again.
 
 
 
In addition to setting fill colors 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 customize your symbols even further.
 
 
 
Each type of vector (point, line and polygon) has its own set of symbol layer types. First we will look at the types available for points.
 
 
 
==== Point symbol layer types ====
 
 
 
* Change the symbol properties for the ''places'' layer:
 
 
 
<span>[[Image:0282.png|image]]</span>
 
 
 
* You can access the various symbol layer types here:
 
 
 
<span>[[Image:0291.png|image]]</span>
 
 
 
* Investigate the various options available to you, and choose a symbol layer type other than the default ''Simple Marker''.
 
 
 
==== Line symbol layer types ====
 
 
 
To see the various options available for line data:
 
 
 
* Change the symbol layer type for the ''street'' layer’s “residential” layer:
 
 
 
<span>[[Image:0301.png|image]]</span>
 
 
 
* Click on the ''Change'' button next to the ''Marker'' label.
 
* Change the symbol properties to match this dialog:
 
 
 
<span>[[Image:0311.png|image]]</span>
 
 
 
* Change the interval to <span><code>2,00</code></span>:
 
 
 
<span>[[Image:0321.png|image]]</span>
 
 
 
* Ensure that the symbol levels are correct before applying the style.
 
 
 
Once you have applied the style, take a look at its results on the map. If you look closely, 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.
 
 
 
==== Polygon symbol layer types ====
 
 
 
To see the various options available for polygon data:
 
 
 
* Change one or more of the symbol layer type for the ''bandung_districts'' layer, as before for the other layers.
 
* Investigate what the different options on the list can do.
 
* You can change each symbol by double-clicking on the symbol you want to change
 
 
 
<span>[[Image:033a.png|image]]</span>
 
 
 
* In this particularl example we have categorised the data. You will learn more about this in the next chapter.
 
* Choose one of them that you find suitable.
 
* If in doubt, use a combination of two layers, using the ''Point pattern fill'' and a ''Simple fill'':
 
 
 
<span>[[Image:0341.png|image]]</span>
 
 
 
* Use the ''Symbol layer type'' Point pattern fill
 
* The ''Marker'' should be a Simple marker
 
* Choose an appropriate border and fill colour (this can be the same colour)
 
* Choose an appropriate marker size
 
* Click ''OK''
 
* Add a new symbol layer with a normal ''Simple fill''.
 
* Make it a contrasting colour to your first layer
 
* Move it underneath the point pattern symbol layer with the ''Move down'' button:
 
 
 
As a result, you have a textured symbol for your chosen layers, with the added benefit that you can change the size, shape and distance of the individual dots that make up the texture. The following screenshot shows we have changed two layers using the above method.
 
 
 
<span>[[Image:0351.png|image]]</span>
 
 
 
=== In conclusion ===
 
 
 
Changing the symbology for the different layers can transformed a collection of vector files into a legible map. Not only can you see what’s happening, it’s even nice to look at!
 
 
 
You can even create your own, custom SVG fill using vector editing software such as Inkscape, which is freely available on the internet.
 
 
 
=== Further reading ===
 
 
 
[http://gis.stackexchange.com/questions/3083/examples-of-beautiful-maps Examples of Beautiful Maps]<ref>http://gis.stackexchange.com/questions/3083/examples-of-beautiful-maps
 
</ref>
 
 
 
=== What’s next? ===
 
 
 
Changing symbols for whole layers is useful, but the information contained within each layer is not yet available to someone reading these maps. What are the streets called? Which administrative regions do certain areas belong to? What are the relative surface areas of the farms? All of this information is still hidden. The next lesson will explain how to represent this data on your map.
 
 
 
<span>note</span><span>Note:</span> Did you remember to save your map recently?
 
 
 
= Module: Classifying Vector Data =
 
 
 
[vector<sub>c</sub>lassification/index:mod-classifying-vector-data] Classifying vector data allows you to assign different symbols to features (different objects in the same layer), depending on their attributes. This allows someone who uses the map to easily see the attributes of various features.
 
 
 
== Lesson: Attribute Data ==
 
 
 
[vector<sub>c</sub>lassification/attribute<sub>d</sub>ata::doc] 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, all the farms look 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.
 
 
 
'''The goal of this lesson:''' To explore the attribute data of an object and understand what the various data can be useful for.
 
 
 
=== [[Image:basic18.png|image]] Follow along: Attribute data ===
 
 
 
[vector<sub>c</sub>lassification/attribute<sub>d</sub>ata:backlink-labels-attribute-data-1] Open the attribute table for the ''places'' layer (refer back to the section ''“Working with Vector Data”'' if necessary). Which field would be the most useful to represent in label form, and why?
 
 
 
=== In conclusion ===
 
 
 
You now know how to use the attribute table to see what is actually in the data you’re using. Any 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.
 
 
 
=== What’s next? ===
 
 
 
Different attributes are useful for different purposes. Some of them can be represented directly as text for the map user to see. You’ll learn how to do this in the next lesson.
 
 
 
== Lesson: The Label Tool ==
 
 
 
[vector<sub>c</sub>lassification/label<sub>t</sub>ool::doc] Labels can be added to a map to show any information about an object. Any vector layer can have labels associated with it. These labels rely on the attribute data of a layer for their content.
 
 
 
<span>note</span><span>Note:</span> The ''Layer Properties'' dialog does have a ''Labels'' tab, but for this example we will not be using it. It has too few options and may be difficult to work with, which is why it will probably be taken out of new versions of QGIS (after 1.8). Instead, for this lesson we’ll use the separate ''Label tool'', which has more options and is more user-friendly.
 
 
 
'''The goal for this lesson:''' To apply useful and good-looking labels to a layer.
 
 
 
=== [[Image:basic18.png|image]] Follow along: Using labels ===
 
 
 
Before being able to access the Label tool, you will need to ensure that it has been activated.
 
 
 
* Go to the menu item ''View <math>\rightarrow</math> Toolbars''.
 
* Ensure that the ''Label'' item has a check mark next to it. If it doesn’t, click on the ''Label'' item, and it will be activated.
 
* Click on the ''places'' layer in the ''Layers list'', so that it is highlighted.
 
* Click on the following toolbar button:
 
 
 
<span>[[Image:00110.png|image]]</span>
 
 
 
This gives you the ''Layer labeling settings'' dialog.
 
 
 
* Check the box next to ''Label this layer with...''.
 
 
 
<span>[[Image:00311.png|image]]</span>
 
 
 
You’ll need to choose which field in the attributes will be used for the labels. In the previous lesson, you decided that the <span><code>NAME</code></span> field was the most suitable one for this purpose.
 
 
 
* Click ''OK''.
 
 
 
The map should now have labels like this:
 
 
 
<span>[[Image:00511.png|image]]</span>
 
 
 
=== [[Image:basic18.png|image]] Follow along: Changing label options ===
 
 
 
What we have so far 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!
 
 
 
* Open the ''Label tool'' again by clicking on its button as before.
 
* Click on the ellipsis (''...'') button to change the text properties:
 
 
 
<span>[[Image:00610.png|image]]</span>
 
 
 
A standard text change dialog appears, similar to those in many other programs. Change the font to <span><code>Arial</code></span> size <span><code>9</code></span>. Your labels will now look like this:
 
 
 
<span>[[Image:00710.png|image]]</span>
 
 
 
This solves the font problem, and now let’s look at the problem of the labels overlapping the points, but before we do that, let’s take a look at the ''Buffer'' option.
 
 
 
* Open the ''Label tool'' dialog.
 
* Deactivate the label buffer by clicking on the checkbox next to the text that says ''Buffer''.
 
* Click ''Apply''.
 
 
 
Note the effects in the map:
 
 
 
<span>[[Image:00810.png|image]]</span>
 
 
 
Now you can see why we usually need label buffers!
 
 
 
* Reactivate the buffers by clicking in the same checkbox as before, and then clicking ''Apply''.
 
 
 
Back to the problem of the labels that overlap points.
 
 
 
* In the ''Label tool'' dialog, go to the ''Advanced'' tab.
 
* Change the value of ''Label distance'' to <span><code>2</code></span>.
 
 
 
<span>[[Image:0099.png|image]]</span>
 
 
 
* Click ''Apply''.
 
 
 
This is the result:
 
 
 
<span>[[Image:0109.png|image]]</span>
 
 
 
=== [[Image:moderate18.png|image]] Follow along: Using labels instead of layer symbology ===
 
 
 
In many cases, the location of a point doesn’t need to be very specific. For example, when they refer to entire towns or suburbs, and the specific point associated with such features is not that specific on a large scale. In fact, giving a point that is too specific is often confusing for someone reading a map.
 
 
 
To name an example: on a map of the world, the point given for the European Union may be somewhere in Poland, for instance. To someone reading the map, seeing a point labeled ''European Union'' in Poland, it may seem that the capital of the European Union is therefore in Poland.
 
 
 
So, to prevent this kind of misunderstanding, it’s often useful to deactivate the point symbols and replace them completely with labels.
 
 
 
In QGIS, you can do this by changing the position of the labels to be rendered directly over the points they refer to.
 
 
 
* Open the ''Layer labeling settings'' dialog for the ''places'' layer.
 
* Go to the ''Advanced'' tab.
 
* Click on the ''over point'' button.
 
 
 
<span>[[Image:0119.png|image]]</span>
 
 
 
* Hide the point symbols by editing the layer style as usual, and setting the size of points to <span><code>0</code></span>:
 
 
 
<span>[[Image:0128.png|image]]</span>
 
 
 
* Click ''OK'' and you’ll see this result:
 
 
 
<span>[[Image:01310.png|image]]</span>
 
 
 
As you can see, some of the labels are now missing to prevent overlap (at this scale). Sometimes this is what you want when dealing with datasets that have many points, but at other times you will lose useful information this way. There is another possibility for handling cases like this, which we’ll cover in a later exercise in this lesson.
 
 
 
=== [[Image:moderate18.png|image]] Try yourself... Customize the labels ===
 
 
 
[vector<sub>c</sub>lassification/label<sub>t</sub>ool:moderate-ty-customize-the-labels]
 
 
 
* Return the label and symbol settings to the way they were before.
 
 
 
* Set the map to the scale <span><code>1:20000</code></span>. You can do this by typing it into the ''Scale'' box in the ''Status Bar''.
 
* Modify your labels to be suitable for viewing at this scale.
 
 
 
=== [[Image:moderate18.png|image]] Follow along: Labeling lines ===
 
 
 
Now that you know how labeling 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, your results would look like this:
 
 
 
<span>[[Image:0179.png|image]]</span>
 
 
 
This is not very useful! To make lines behave, we’ll need to edit some options.
 
 
 
* Hide the ''places'' layer so that it doesn’t distract you.
 
* Zoom in on the town area.
 
* Activate labels for the ''streets'' layer as before. (Remember to use the ''Label tool'' on the toolbar, not the one in ''Label Properties''!)
 
* Set the font ''Size'' to <span><code>9</code></span> so that you can see more labels.
 
* In the ''Label tool'' dialog’s ''Advanced'' tab, choose the following settings:
 
 
 
<span>[[Image:0189.png|image]]</span>
 
 
 
The map will look somewhat like this, depending on scale:
 
 
 
<span>[[Image:0197.png|image]]</span>
 
 
 
It’s better than before, 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:
 
 
 
* Enable the option ''Merge connected lines to avoid duplicate labels'' (also under the ''Advanced'' tab - you may need to scroll down to see it).
 
 
 
Another useful function is to prevent labels being drawn for features too short to be of notice.
 
 
 
* Set the value of ''Suppress labeling of features smaller than ...'' to <span><code>5mm</code></span> and note the results when you click ''Apply''.
 
 
 
Try out different ''Placement'' settings as well (also under the ''Advanced'' tab). As we’ve seen before, the ''horizontal'' option is not a good idea in this case, so let’s try the ''curved'' option instead!
 
 
 
* Select the ''curved'' option under the ''Advanced'' tab of the ''Layer labeling settings'' dialog.
 
 
 
Here’s the result:
 
 
 
<span>[[Image:02010.png|image]]</span>
 
 
 
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.
 
 
 
=== [[Image:hard18.png|image]] Follow along: Data defined settings ===
 
 
 
* Deactivate labeling for the ''streets'' layer.
 
* Reactivate labeling for the ''places'' layer.
 
* Open the attribute table for ''places''.
 
 
 
It has two fields that are of interest to us now: <span><code>AMENITY</code></span> and <span><code>RESTAURANT</code></span>. <span><code>AMENITY</code></span> is what type of place it is. <span><code>RESTAURANT</code></span> is derived from it, and tells you whether or not that feature is a restaurant (<span><code>1</code></span> if it is, <span><code>0</code></span> if not). We can use this data to influence the label styles.
 
 
 
* Navigate to the ''Data defined settings'' tab.
 
* In the ''Italic'' dropdown, select <span><code>RESTAURANT</code></span> and click ''Apply''.
 
 
 
Notice its effects:
 
 
 
<span>[[Image:0228.png|image]]</span>
 
 
 
=== [[Image:hard18.png|image]] Try yourself... Using data defined settings ===
 
 
 
[vector<sub>c</sub>lassification/label<sub>t</sub>ool:backlink-label-data-defined-1]
 
 
 
<span>note</span><span>Note:</span> We’re jumping ahead a bit here to demonstrate some advanced labeling settings. At the advanced level, it’s assumed that you’ll know what the following means. If you don’t, feel free to leave out this section and come back later when you’ve covered the requisite materials.
 
 
 
* Open the attribute table for ''places''.
 
* Enter edit mode by clicking this button (at the lower edge of the attribute table):
 
 
 
<span>[[Image:02310.png|image]]</span>
 
 
 
* Add a new column:
 
 
 
<span>[[Image:02410.png|image]]</span>
 
 
 
* Configure it like this:
 
 
 
<span>[[Image:0259.png|image]]</span>
 
 
 
* Use this to set custom font sizes for each different type of amenity (i.e., each key in the <span><code>AMENITY</code></span> field).
 
 
 
=== [[Image:hard18.png|image]] Further possibilities with labeling ===
 
 
 
We can’t cover every option in this course, but be aware that the ''Label tool'' has many other useful functions. You can set scale-based rendering, alter the rendering priority for labels in a layer, and set every label option using layer attributes. You can even set the rotation, XY position, and other properties of a label (if you have attribute fields allocated for the purpose), then edit these properties using the tools adjacent to the main ''Label tool'':
 
 
 
<span>[[Image:0288.png|image]]</span>
 
 
 
(These tools will be active if the required attribute fields exist and you are in edit mode.)
 
 
 
Feel free to explore more possibilities of the labeling system.
 
 
 
=== In conclusion ===
 
 
 
You’ve learned how to use layer attributes to create dynamic labels. This can make your map a lot more informative and stylish!
 
 
 
=== What’s next? ===
 
 
 
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 lesson!
 
 
 
== Lesson: Classification ==
 
 
 
[vector<sub>c</sub>lassification/classification::doc] 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 someone wants to know what types of land cover are in the Bandung districts area. Using labels, you’d get this:
 
 
 
<span>[[Image:0019.png|image]]</span>
 
 
 
Obviously this is not ideal, so we need another solution. That’s what this lesson is about!
 
 
 
'''The goal for this lesson:''' To learn how to classify vector data effectively.
 
 
 
=== [[Image:basic18.png|image]] Follow along: Classifying nominal data ===
 
 
 
* Open ''Layer Properties'' for ''bandung_districts''
 
* Go to the ''Style'' tab.
 
* Click on the dropdown that says ''Single Symbol'':
 
 
 
<span>[[Image:00210.png|image]]</span>
 
 
 
* Change it to ''Categorized'' and the interface will change:
 
 
 
<span>[[Image:00310.png|image]]</span>
 
 
 
* Change the ''Column'' to ''LANDCOVER'' and the ''Color ramp'' to ''random'':
 
 
 
<span>[[Image:0048.png|image]]</span>
 
 
 
* Click the button labeled ''Classify'' and then click ''OK''.
 
 
 
You’ll see something like this:
 
 
 
<span>[[Image:00510.png|image]]</span>
 
 
 
* Click the arrow (or plus sign) next to ''bandung_districts'' in the ''Layer list'', you’ll see the categories explained:
 
 
 
<span>[[Image:0069.png|image]]</span>
 
 
 
So, this is useful! But it hurts your eyes to look at it, so let’s see what we can do about that.
 
 
 
* Open ''Layer Properties'' and go to the ''Style'' tab again.
 
* Change the symbol:
 
 
 
<span>[[Image:0079.png|image]]</span>
 
 
 
* Get rid of the outline the same way you did before, and click ''OK''. (If you need to, go back to the lesson where we covered this to remember how it’s done.)
 
* Click the ''Delete all'' button:
 
 
 
<span>[[Image:0089.png|image]]</span>
 
 
 
This gets rid of the ugly classes so you can try again.
 
 
 
* Choose a new option from the ''Color ramp''
 
* Click ''Classify'' again, and the new symbols will appear.
 
 
 
You’ll notice they don’t have outlines. This is because you just removed the outlines.
 
 
 
* Change the color for ''Water bodies'' by double-clicking on the colored block representing its symbol:
 
 
 
<span>[[Image:0098.png|image]]</span>
 
 
 
Use your own colors, so that the resulting map isn’t as ugly as the old one. In the example, we’ll use these colors, with our water bodies colored blue:
 
 
 
<span>[[Image:0118.png|image]]</span>
 
 
 
This gives us a nice map:
 
 
 
<span>[[Image:0108.png|image]]</span>
 
 
 
There is one category that is empty:
 
 
 
<span>[[Image:0127.png|image]]</span>
 
 
 
* Select the empty category.
 
* Click the ''Delete'' button.
 
 
 
This only gets rid of the symbol, not the data, so don’t worry about messing up; you’re not actually deleting anything that you can’t recover.
 
 
 
Remember to save your map now so that you don’t lose all your hard-earned changes!
 
 
 
=== [[Image:basic18.png|image]] Try yourself... More classification ===
 
 
 
If you’re only following the basic-level content, use the knowledge you gained above to classify the ''urban'' areas. Use darker colors to set them apart from the farms.
 
 
 
=== [[Image:moderate18.png|image]] Follow along: Ratio classification ===
 
 
 
There are four types of classification: ''nominal'', ''ordinal'', ''interval'' and ''ratio''.
 
 
 
In nominal classification, the categories that objects are classified into are name-based; they have no order. For example: town names, district codes, etc.
 
 
 
In ordinal classification, the categories are arranged in a certain order. For example, world cities are given a rank depending on their importance for world trade, travel, culture, etc.
 
 
 
In interval classification, the numbers are on a scale with positive, negative and zero values. For example: height above/below sea level, temperature above/below freezing (0 degrees Celsius), etc.
 
 
 
In ratio classification, the numbers are on a scale with only positive and zero values. For example: temparature above absolute zero (0 degrees Kelvin), distance from a point, the average amount of traffic on a given street per month, etc.
 
 
 
In the example above, we used nominal classification to show different land cover areas. Now we will begin a new project, and look at ratio classification to classify villages by area.
 
 
 
* Save your rural symbology (if you want to keep it) by clicking on the ''Save Style ...'' button in the ''Style'' dialog.
 
* Close the ''Style'' dialog.
 
* Save and close your current project.
 
 
 
Now we will begin our new exercise.
 
 
 
* Open a new, blank project
 
* Open the layers ''Sulawesi_dist_32750'' and ''VillagePolyBarSin_32750''.
 
* Change the colour styles if necessary.
 
 
 
We want to classify these villages by area, but there is a problem: they do not have an area field! We will have to make one.
 
 
 
* Enter edit mode by clicking this button:
 
 
 
<span>[[Image:0139.png|image]]</span>
 
 
 
* Add a new column with this button:
 
 
 
<span>[[Image:0149.png|image]]</span>
 
 
 
* Set up the dialog that appears, like this:
 
 
 
<span>[[Image:0156.png|image]]</span>
 
 
 
* Click ''OK''.
 
 
 
The new field will be added (at the far right of the table; you may need to scroll horizontally to see it). However, at the moment it is not populated, it just has a lot of <span><code>NULL</code></span> values.
 
 
 
To solve this problem, we’ll need to calculate the areas.
 
 
 
* Open the field calculator:
 
 
 
<span>[[Image:0168.png|image]]</span>
 
 
 
You’ll get this dialog:
 
 
 
<span>[[Image:0188.png|image]]</span>
 
 
 
* Change the values at the top of the dialog to look like this:
 
 
 
<span>[[Image:0178.png|image]]</span>
 
 
 
* In the ''Function List'', select ''Geometry <math>\rightarrow</math> $area'':
 
 
 
<span>[[Image:0196.png|image]]</span>
 
 
 
* Double-click on it so that it appears in the ''Expression'' field.
 
* Click ''OK''.
 
 
 
Now your <span><code>AREA</code></span> field is populated with values! Admire them, then close the attribute table.
 
 
 
<span>note</span><span>Note:</span> These areas are in degrees area. Later, we will compute them in square meters.
 
 
 
* Open the ''Layer properties'' dialog’s ''Style'' tab.
 
* Change the classification style from ''Classified'' to ''Graduated'':
 
 
 
<span>[[Image:0209.png|image]]</span>
 
 
 
* Change the ''Column'' to ''AREA'':
 
 
 
<span>[[Image:0218.png|image]]</span>
 
 
 
* Under ''Color ramp'', choose the option ''New color ramp...'' to get this dialog:
 
 
 
<span>[[Image:0227.png|image]]</span>
 
 
 
* Choose ''Gradient'' (if it’s not selected already) and click ''OK''. You’ll see this:
 
 
 
<span>[[Image:0239.png|image]]</span>
 
 
 
You’ll be using this to denote area, with small areas as ''Color 1'' and large areas as ''Color 2''.
 
 
 
* Choose appropriate colors.
 
 
 
In the example, the result looks like this:
 
 
 
<span>[[Image:0249.png|image]]</span>
 
 
 
* Click ''OK''.
 
* Choose a suitable name for the new color ramp.
 
* Click ''OK'' after filling in the name.
 
 
 
Now you’ll have something like this:
 
 
 
<span>[[Image:0258.png|image]]</span>
 
 
 
Leave everything as-is.
 
 
 
* Click ''Apply'':
 
 
 
<span>[[Image:0267.png|image]]</span>
 
 
 
=== [[Image:moderate18.png|image]] Try yourself... Refine the classification ===
 
 
 
[vector<sub>c</sub>lassification/classification:backlink-classification-refine-1]
 
 
 
* Get rid of the lines between the classes.
 
* Change the values of ''Mode'' and ''Classes'' until you get a classification that makes sense.
 
 
 
=== [[Image:hard18.png|image]] Follow along: Rule-based classification ===
 
 
 
It’s often useful to combine multiple criteria for a classification, but unfortunately normal classification only takes one attribute into account. That’s where rule-based classification comes in handy.
 
 
 
* Open the ''Layer Properties'' dialog for the ''rural'' layer.
 
* Switch to the ''Style'' tab.
 
* Switch the classification style to ''Rule-based''. You’ll get this:
 
 
 
<span>[[Image:0296.png|image]]</span>
 
 
 
* Click the ''Add'' button.
 
* A new dialog that appears.
 
* Click the ellipsis ''...'' button next to the ''Filter'' text area.
 
* Using the query builder that appears, enter the criterion <span><code>AREA &gt;= 30000000</code></span> and choose a light color for it.
 
* Add the criterion <span><code>AREA &lt;= 30000000</code></span> and choose a dark color.
 
* Add the criterion <span><code>DESA = ’Ajakkang’</code></span> and assign it the color black, with transparency at <span><code></code>35%</span>.
 
* Use the ''Rendering order'' to render the layers correctly so Ajakkang is visible.
 
 
 
Your dialog should look like this:
 
 
 
<span>[[Image:0306.png|image]]</span>
 
 
 
* Apply this symbology.
 
 
 
Your map will look like this:
 
 
 
<span>[[Image:0313.png|image]]</span>
 
 
 
Now you have two area classes, with the village Ajakkang highlighted.
 
 
 
=== In conclusion ===
 
 
 
Symbology allows us to represent the attributes of a layer in an easy-to-read way. It allows us as well as the map reader to understand the significance of features, using any relevat attributes that we choose. Depending on the problems you face, you’ll apply different classification techniques to solve them.
 
 
 
=== What’s next? ===
 
 
 
Now we have a nice-looking map, but how are we going to get it out of QGIS and into a format we can print out, or make into an image or PDF? That’s the topic of the next lesson!
 
 
 
= Module: Creating Maps =
 
 
 
[map<sub>c</sub>omposer/index::doc] In this module, you’ll learn how to use the QGIS Map Composer to produce quality maps with all the requisite map components.
 
 
 
== Lesson: Using Map Composer ==
 
 
 
[map<sub>c</sub>omposer/map<sub>c</sub>omposer:ls-using-map-composer] Now that you’ve got a map, you need to be able to print it or to export it to a document. The reason is, a GIS map file is not an image. It saves the state of the GIS program, with references to all the layers, their labels, colors, etc. So for someone who doesn’t have the data or the same GIS program (such as QGIS), the map file will be useless. Luckily, QGIS can export its map file to a format that anyone’s computer can read, as well as printing out the map if you have a printer connected. Both exporting and printing is handled via the Map Composer.
 
 
 
'''The goal for this lesson:''' To use the QGIS Map Composer to create a basic map with all the required settings.
 
 
 
=== [[Image:basic10.png|image]] Follow along: The Composer Manager ===
 
 
 
QGIS allows you to create multiple maps using the same map file. For this reason, it has a tool called the ''Composer Manager''.
 
 
 
* Zoom in on the area of your map showing the streets and places of Bandung.
 
* Click on the ''File <math>\rightarrow</math> Composer Manager'' menu entry to open this tool. You’ll see a blank ''Composer manager'' dialog appear.
 
* Click the ''Add'' button and a new composer will be added called ''Composer 1'' (it may be another number if you have tried using the ''Composer Manager'' before now).
 
* With your new composer selected, click on the ''Rename'' button and rename it to <span><code>Bandung</code></span>.
 
* Click ''OK''.
 
* Click the ''Show'' button.
 
 
 
(You could also close the dialog and navigate to a composer via the ''File <math>\rightarrow</math> Print Composers'' menus, as in the image below.)
 
 
 
<span>[[Image:0035.png|image]]</span>
 
 
 
Whichever route you take to get there, you will now see the ''Print Composer'' window.
 
 
 
=== [[Image:basic10.png|image]] Follow along: Basic Map Composition ===
 
 
 
In this example, the composition was already the way we wanted it. Ensure that yours is as well.
 
 
 
* Check that the values under ''General <math>\rightarrow</math> Composition <math>\rightarrow</math> Paper and Quality'' are set to the following:
 
 
 
* ''Size'': <span><code>A4 (210x297mm)</code></span>
 
* ''Orientation'': <span><code>Landscape</code></span>
 
* ''Quality'': <span><code>300dpi</code></span>
 
 
 
Now you’ve got the page layout the way you wanted it, but this page is still blank. It clearly lacks a map. Let’s fix that!
 
 
 
* Click on the ''Add New Map'' button:
 
 
 
<span>[[Image:0055.png|image]]</span>
 
 
 
With this tool activated, you’ll be able to place a map on the page.
 
 
 
* Click and drag a box on the blank page:
 
 
 
<span>[[Image:0064.png|image]]</span>
 
 
 
The map will appear on the page.
 
 
 
* Move the map by clicking and dragging it around:
 
 
 
<span>[[Image:0075.png|image]]</span>
 
 
 
* Resize it by clicking and dragging the boxes in the corners:
 
 
 
<span>[[Image:0084.png|image]]</span>
 
 
 
<span>note</span><span>Note:</span> Your map may look a lot different, of course! This depends on how your own project is set up. But not to worry! These instructions are general, so they will work the same regardless of what the map itself looks like.
 
 
 
* Be sure to leave margins along the edges, and a space along the top for the title:
 
 
 
<span>[[Image:0093.png|image]]</span>
 
 
 
* Zoom in and out on the page (but not the map!) by using these buttons:
 
 
 
<span>[[Image:0104.png|image]]</span>
 
 
 
* Zoom and pan the map in the main QGIS window. You can also pan the map using the ''Move item content'' tool:
 
 
 
<span>[[Image:0234.png|image]]</span>
 
 
 
When zooming in, the map view will not refresh by itself. This is so that it doesn’t waste your time redrawing the map while you’re zooming the page to where you want it, but it also means that if you zoom in or out, the map will be at the wrong resolution and will look ugly or unreadable.
 
 
 
* Force the map to refresh by clicking this button:
 
 
 
<span>[[Image:0112.png|image]]</span>
 
 
 
Remember that the size and position you’ve given the map doesn’t need to be final. You can always come back and change it later if you’re not satisfied. For now, you need to ensure that you’ve saved your work on this map. Because a ''Composer'' in QGIS is part of the main map file, you’ll need to save your main project. Go to the main QGIS window (the one with the ''Layers list'' and all the other familiar elements you were working with before), and save your project from there as usual.
 
 
 
=== [[Image:basic10.png|image]] Follow along: Adding a Title ===
 
 
 
Now your map is looking good on the page, but the reader is not being told what’s going on yet. They need some context, which is what you’ll provide for them by adding map elements. First, let’s add a title.
 
 
 
* Click on this button:
 
 
 
<span>[[Image:0123.png|image]]</span>
 
 
 
* Click on the page, and a label will appear:
 
 
 
<span>[[Image:0134.png|image]]</span>
 
 
 
* Resize it and place it in the top center of the page. It can be resized and moved in the same way that you resized and moved the map.
 
 
 
<span>[[Image:0144.png|image]]</span>
 
 
 
But if you tried it, you’ll see that it’s difficult to align the label to be completely centered to the map! Luckily, there’s a tool for that.
 
 
 
* Click the map to select it.
 
* Hold in <span><code>shift</code></span> on your keyboard and click on the label.
 
* Look for this tool (but don’t click it yet):
 
 
 
<span>[[Image:0153.png|image]]</span>
 
 
 
* Click on the downwards arrow next to the button.
 
* Click ''Align center'':
 
 
 
<span>[[Image:0164.png|image]]</span>
 
 
 
To make sure that you don’t accidentally move these elements around now that you’ve aligned them:
 
 
 
* Right-click on both the map and the label.
 
 
 
A small lock icon will appear in the corner to tell you that an element can’t be dragged right now. You can always right-click on an element again to unlock it, though.
 
 
 
Now the label is centered to the map, but not the contents. To center the contents of the label:
 
 
 
* Select the label by clicking on it.
 
* Click on the ''Item'' tab in the side panel of the ''Composer'' window.
 
* Change the text of the label to “Bandung”:
 
 
 
<span>[[Image:0174.png|image]]</span>
 
 
 
* Use this interface to set the font and alignment options:
 
 
 
<span>[[Image:0184.png|image]]</span>
 
 
 
* Choose a large but sensible font (the example will use the default font with a size of <span><code>36</code></span>), and keep the color subdued.
 
 
 
In fact, it’s probably best to keep it black as per the default. The key is that the font should not be distracting, otherwise people who see the page will be looking at the heading instead of reading the map!
 
 
 
* Set the ''Horizontal Alignment'' to ''Center'', so that the heading is properly centered within the label.
 
 
 
<span>[[Image:0194.png|image]]</span>
 
 
 
This is progressing nicely, but the label still has an unnecessary frame around it:
 
 
 
<span>[[Image:0204.png|image]]</span>
 
 
 
Let’s get rid of it.
 
 
 
* Click on the ''General options'' slider at the bottom of the ''Item'' tab. The ''Label'' slider will slide away and you will see a new interface.
 
* Click the ''Show frame'' checkbox to disable the frame:
 
 
 
<span>[[Image:0214.png|image]]</span>
 
 
 
Here is our page so far:
 
 
 
<span>[[Image:0224.png|image]]</span>
 
 
 
=== [[Image:basic10.png|image]] Follow along: Adding a Legend ===
 
 
 
The map reader also needs to be able to see what various things on the map actually mean. In some cases, like the place names, this is quite obvious. In other cases, it’s more difficult to guess, like the colors of the farms. Let’s add a new legend.
 
 
 
* Click on this button:
 
 
 
<span>[[Image:0245.png|image]]</span>
 
 
 
* Click on the page to place the legend, and move it to where you want it:
 
 
 
<span>[[Image:0255.png|image]]</span>
 
 
 
In this example, the legend is far too big. We will now learn how to customize the legend.
 
 
 
=== [[Image:moderate10.png|image]] Follow along: Customizing Legend Items ===
 
 
 
Not everything on the legend is necessary, so let’s remove some unwanted items.
 
 
 
* In the ''Item'' tab, click on the ''Legend items'' slider.
 
* Select the ''places'' entry.
 
* Delete it from the legend by clicking the ''minus'' button:
 
 
 
<span>[[Image:0265.png|image]]</span>
 
 
 
* Remove any other items that you don’t think are necessary.
 
 
 
You can also rename items.
 
 
 
* Select a layer from the same list.
 
* Click the ''Edit'' button:
 
 
 
<span>[[Image:0276.png|image]]</span>
 
 
 
* Rename the layers to <span><code>Roads and Streets</code></span>, <span><code>Water ways</code></span>, and <span><code>Land cover</code></span>.
 
* Click the down arrow next to any item with multiple classes to rename the classes (using the same method as above).
 
* Remove any layers not necessary (for example, areas of land cover that are
 
 
 
not displayed on the map).
 
 
 
This is the result in the example. We have moved the legend to the side of the map and realigned the title with the map:
 
 
 
<span>[[Image:0285.png|image]]</span>
 
 
 
=== [[Image:basic10.png|image]] Follow along: Exporting Your Map ===
 
 
 
<span>note</span><span>Note:</span> Did you remember to save your work often?
 
 
 
Finally the map is ready for export! You’ll see the export buttons near the top left corner of the ''Composer'' window:
 
 
 
<span>[[Image:0294.png|image]]</span>
 
 
 
The button on the right is the ''Print'' button, which interfaces with a printer. Since the printer options will differ depending on the model of printer that you’re working with, it’s probably better to consult the printer manual or a general guide to printing for more information on this topic.
 
 
 
The other three buttons allow you to export the map page to a file. There are three export formats to choose from:
 
 
 
* ''Export as Image''
 
* ''Export as PDF''
 
* ''Export as SVG''
 
 
 
Exporting as an image will give you a selection of various common image formats to choose from. This is probably the simplest option, but the image it creates is “dead” and difficult to edit.
 
 
 
The other two options are more common.
 
 
 
If you’re sending the map to a cartographer (who may want to edit the map for publication), it’s best to export as an SVG. SVG stands for “Scalable Vector Graphic”, and can be imported to programs like Inkscape or other vector image editing software.
 
 
 
If you need to send the map to a client, it’s most common to use a PDF, because it’s easier to set up printing options for a PDF. Some cartographers may prefer PDF as well, if they have a program that allows them to import and edit this format.
 
 
 
For our purposes, we’re going to use PDF.
 
 
 
* Click the ''Export as PDF'' button:
 
 
 
<span>[[Image:0303.png|image]]</span>
 
 
 
* Choose a save location and a file name as usual.
 
* Click ''Save''.
 
 
 
=== In conclusion ===
 
 
 
* Close the ''Composer'' window.
 
* Save your map.
 
* Find your exported PDF using your operating system’s file manager.
 
* Open it.
 
* Bask in its glory.
 
 
 
Congratulations on your first completed QGIS map project!
 
 
 
=== What’s next? ===
 
 
 
On the next page, you will be given an assignment to complete. This will allow you to practice the techniques you have learned so far.
 
 
 
== Assignment 1 ==
 
 
 
[map<sub>c</sub>omposer/day<sub>1a</sub>ssignment::doc] Open your existing map project and revise it thoroughly. If you have noticed small errors or things you’d have liked to fix earlier, do so now.
 
 
 
If you are following this course at a ''Basic'' or ''Intermediate'' level, try to understand and implement techniques taught at a higher level.
 
 
 
While customizing your map, keep asking yourself questions. Is this map easy to read and understand for someone who’s unfamiliar with the data? If I saw this map on the Internet, or on a poster, or in a magazine, would it capture my attention? Would I want to read this map if it wasn’t mine?
 
 
 
If you’re doing this course at a [[Image:basic10.png|image]] Basic or [[Image:moderate10.png|image]] Intermediate level, read up on techniques from the more advanced sections. If you see something you’d like to do in your map, why not try to implement it?
 
 
 
If this course is being presented to you, the course presenter may require you to submit a final version of your map, exported to PDF, for evaluation. If you’re doing this course by yourself, it’s recommended that you evaluate your own map using the same criteria. Your map will be evaluated on the overall appearance and symbology of the map itself, as well as the appearance and layout of the map page and elements. Remember that the emphasis for evaluating the appearance of maps will always be ''ease of use''. The nicer the map is to look at and the easier it is to understand at a glance, the better.
 
 
 
Happy customizing! :)
 
 
 
=== In conclusion ===
 
 
 
The first four modules have taught you how to create and style a vector map. In the next four modules, you’ll learn how to use QGIS for a complete GIS analysis. This will include creating and editing vector data; analyzing vector data; using and analyzing raster data; and using GIS to solve a problem from start to finish, using both raster and vector data sources.
 
 
 
= Module: Creating Vector Data =
 
 
 
[create<sub>v</sub>ector<sub>d</sub>ata/index:mod-creating-vector-data] Creating maps using existing data is just the beginning. In this module, you’ll learn how to modify existing vector data and create new datasets entirely.
 
 
 
== Lesson: Creating a New Vector Dataset ==
 
 
 
[create<sub>v</sub>ector<sub>d</sub>ata/create<sub>n</sub>ew<sub>v</sub>ector:ls-creating-a-new-vector-dataset] The data that you use has to come from somewhere. For most common applications, the data exists already; but the more particular and specialized the project, the less likely it is that the data will already be available. In such cases, you’ll need to create your own new data.
 
 
 
'''The goal for this lesson:''' To create a new vector dataset.
 
 
 
=== [[Image:basic6.png|image]] Follow along: The Layer Creation Dialog ===
 
 
 
Before you can add new vector data, you need a vector dataset to add it to. In our case, you’ll begin by creating new data entirely, rather than editing an existing dataset. Therefore, you’ll need to define your own new dataset first.
 
 
 
You’ll need to open the ''New Vector Layer'' dialog that will allow you to define a new layer.
 
 
 
* Navigate to and click on the menu entry ''Layer <math>\rightarrow</math> New <math>\rightarrow</math> New Shapefile Layer''.
 
 
 
You’ll be presented with the following dialog:
 
 
 
<span>[[Image:0013.png|image]]</span>
 
 
 
It’s important to decide which kind of dataset you want at this stage. Each different vector layer type is “built differently” in the background, so once you’ve created the layer, you can’t change its type.
 
 
 
For the next exercise, we’re going to be creating new features which describe areas. For such features, you’ll need to create a polygon dataset.
 
 
 
* Click on the ''Polygon'' radio button:
 
 
 
<span>[[Image:0022.png|image]]</span>
 
 
 
This has no impact on the rest of the dialog, but it will cause the correct type of geometry to be used when the vector dataset is created.
 
 
 
The next field allows you to specify the Coordinate Reference System, or CRS. A CRS specifies how to describe a point on Earth in terms of coordinates, and because there are many different ways to do this, there are many different CRSs. The CRS of this project is WGS84, so it’s already correct by default:
 
 
 
<span>[[Image:0033.png|image]]</span>
 
 
 
Next there is a collection of fields grouped under ''New attribute''. By default, a new layer has only one attribute, the <span><code>id</code></span> field (which you should see in the ''Attributes list'') below. However, in order for the data you create to be useful, you actually need to say something about the features you’ll be creating in this new layer! For our current purposes, it will be enough to add one field called <span><code>name</code></span>.
 
 
 
* Replicate the setup below, then click the ''Add to attributes list'' button:
 
 
 
<span>[[Image:0043.png|image]]</span>
 
 
 
* Check that your dialog now looks like this:
 
 
 
<span>[[Image:0052.png|image]]</span>
 
 
 
* Click ''OK''. A save dialog will appear.
 
* Navigate to the <span><code>exercise_data</code></span> directory.
 
* Save your new layer as <span><code>university_property.shp</code></span>.
 
 
 
The new layer should appear in your ''Layers list''.
 
 
 
=== [[Image:basic6.png|image]] Follow along: Data sources ===
 
 
 
When you create new data, it obviously has to be about objects that really exist on the ground. Therefore, you’ll need to get your information from somewhere.
 
 
 
There are many different ways to obtain data about objects. For example, you could use a GPS to capture points in the real world, then import the data into QGS afterwards. Or you could survey points using a theodolite, and enter the coordinates manually to create new features. Or you could use the digitizing process to trace objects off of remote sensing data, such as satellite imagery or aerial photography.
 
 
 
For our example, you’ll be using the digitizing approach. Sample raster datasets are provided, so you’ll need to import them as necessary.
 
 
 
* Click on the ''Add Raster Layer'' button:
 
 
 
<span>[[Image:0061.png|image]]</span>
 
 
 
* Navigate to <span><code>exercise_data/raster/</code></span>.
 
* Select the file <span><code>ITB_raster.tif</code></span>.
 
* Click ''Open''. An image will load into your map.
 
* Find the new image in the ''Layers list''.
 
 
 
<span>[[Image:0072.png|image]]</span>
 
 
 
You’ll be digitizing these three fields:
 
 
 
<span>[[Image:0142.png|image]]</span>
 
 
 
* Hide all the layers except the raster and the ''university_property'' layer.
 
 
 
In order to begin digitizing, you’ll need to enter '''edit mode'''. GIS software commonly requires this to prevent you from accidentally editing or deleting important data. Edit mode is switched on or off individually for each layer.
 
 
 
To enter edit mode for the ''university_property'' layer:
 
 
 
* Right click on the layer in the ''Layer list'' to select it. (Make very sure that the correct layer is selected, otherwise you’ll edit the wrong layer)
 
* Click on the ''Toggle Editing'' button:
 
 
 
<span>[[Image:0081.png|image]]</span>
 
 
 
If you can’t find this button, check that the ''Digitizing'' toolbar is enabled. There should be a check mark next to the ''View <math>\rightarrow</math> Toolbars <math>\rightarrow</math> Digitizing'' menu entry.
 
 
 
As soon as you are in edit mode, you’ll see the digitizing tools are now active:
 
 
 
<span>[[Image:0091.png|image]]</span>
 
 
 
From left to right on the image above, they are:
 
 
 
* ''Toggle Edit'': activates / deactivates edit mode.
 
* ''Save Edits'': saves changes made to the layer.
 
* ''Add Feature'': start digitizing a new feature.
 
* ''Move Feature(s)'': move an entire feature around.
 
* ''Node Tool'': move only one part of a feature.
 
* ''Delete Selected'': delete the selected feature (only active if a feature is selected).
 
* ''Cut Features'': cut the selected feature (only active if a feature is selected).
 
* ''Copy Features'': copy the selected feature (only active if a feature is selected).
 
* ''Paste Features'': paste a cut or copied feature back into the map (only active if a feature has been cut or copied).
 
 
 
You want to add a new feature.
 
 
 
* Click on the ''Add Feature'' button now to begin digitizing right away!
 
 
 
You’ll notice that your mouse cursor has become a crosshair. This allows you to more accurately place the points you’ll be digitizing. Remember that even as you’re using the digitizing 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 be digitizing is the tennis courts:
 
 
 
<span>[[Image:0103.png|image]]</span>
 
 
 
* Start digitizing by clicking on a point somewhere along the edge of the field.
 
* Place more points by clicking further along the edge, until the shape you’re drawing completely covers the field.
 
* To place your last point, ''right-click'' where you want it to be. This will finalize the feature and show you the ''Attributes'' dialog.
 
* Fill in the values as below:
 
 
 
<span>[[Image:0132.png|image]]</span>
 
 
 
* Click ''OK'' and you’ve created a new feature!
 
 
 
Remember, if you’ve made a mistake while digitizing a feature, you can always edit it after you’re done creating it. If you’ve made a mistake, continue digitizing until you’re done creating the feature as above. Then:
 
 
 
* Select the feature with the ''Select Single Feature'' tool:
 
 
 
<span>[[Image:0122.png|image]]</span>
 
 
 
You can use:
 
 
 
* the ''Move Feature(s)'' tool to move the entire feature,
 
* the ''Node Tool'' to move only one point where you may have misclicked,
 
* ''Delete Selected'' to get rid of the feature entirely so you can try again, and
 
* the ''Edit <math>\rightarrow</math> Undo'' menu item or the <span><code>ctrl + z</code></span> keyboard shortcut to undo mistakes.
 
 
 
=== [[Image:basic6.png|image]] Try yourself... ===
 
 
 
* Digitize the athletics field and the swimming pools. Use this image to assist you:
 
 
 
<span>[[Image:0142.png|image]]</span>
 
 
 
Remember that each new feature needs to have a unique <span><code>id</code></span> value.
 
 
 
<span>note</span><span>Note:</span> When you’re done adding features to a layer, remember to save your edits and then exit edit mode.
 
 
 
[create<sub>v</sub>ector<sub>d</sub>ata/create<sub>n</sub>ew<sub>v</sub>ector:backlink-create-vector-digitize-1]
 
 
 
=== In conclusion ===
 
 
 
This lesson has shown you how to create new features in your dataset. This course doesn’t cover adding point features, because that’s not really necessary now you have worked with more complicated features (lines and polygons). Adding point features works exactly the same, except that you only click once where you want the point to be, give it attributes as usual, and then the feature is created.
 
 
 
Knowing how to digitize is important because it’s a very common activity in GIS programs.
 
 
 
=== What’s next? ===
 
 
 
Now that you have been introduced to vector data creation, you can learn how to analyze this data to solve problems. That is the topic of the next module.
 
 
 
= Module: Vector Analysis =
 
 
 
[vector<sub>a</sub>nalysis/index::doc] Now that you have edited a few features, you must want to know what else one can do with them. Having features with attributes is nice, but when all is said and done, this doesn’t really tell you anything that a normal, non-GIS map can’t.
 
 
 
The key advantage of a GIS is this: ''a GIS can answer questions.''
 
 
 
For the next three modules, we will show you the functions of a GIS that you can use to answer a ''research question'' similar to what you may be asked to do as part of your job. This will include:
 
 
 
* projecting layers according to your needs
 
* using Simple Query Language (SQL) to find particular data
 
* creating buffers
 
* finding data contained in more than one layer using the ''Intersect'' tool
 
* find data using the ''Select by location'' tool
 
 
 
== Lesson: Reprojecting and Transforming Data ==
 
 
 
[vector<sub>a</sub>nalysis/reproject<sub>t</sub>ransform:ls-reprojecting-and-transforming-data] Let us talk about Coordinate Reference Systems (CRSs) again. We have touched on this briefly before, but have not discussed what it means practically.
 
 
 
'''The goal for this lesson:''' To reproject and transform vector datasets.
 
 
 
=== [[Image:basic17.png|image]] Follow along: Projections ===
 
 
 
The CRS that all the data as well as the map itself are in right now is called WGS84. This is a very common Geographic Coordinate System (GCS) for representing data. But there’s a problem, as we will see.
 
 
 
* Save your current map.
 
* Then open the map of the world which you’ll find under <span><code>exercise_data/world/world.qgs</code></span>.
 
* Zoom in to Indonesia by using the ''Zoom In'' tool.
 
* Try setting a scale in the ''Scale'' field, which is in the ''Status Bar'' along the bottom of the screen. While over Indonesia, set this value to <span><code>1:5000000</code></span> (one to five million).
 
* Pan around the map while keeping an eye on the ''Scale'' field.
 
 
 
Notice the scale changing? That’s because you’re moving away from the one point that you zoomed into at <span><code>1:5000000</code></span>, which was at the center of your screen. All around that point, the scale is different.
 
 
 
To understand why, think about a globe of the Earth. It has lines running along it from North to South. These longitude lines are far apart at the equator, but they meet at the poles.
 
 
 
In a GCS, you’re working on this sphere, but your screen is flat. When you try to represent the sphere on a flat surface, distortion occurs, similar to what would happen if you cut open a tennis ball and tried to flatten it out. What this means on a map is that the longitude lines stay equally far apart from each other, even at the poles (where they are supposed to meet). This means that, as you travel away from the equator on your map, the scale of the objects that you see gets larger and larger. What this means for us, practically, is that there is no constant scale on our map.
 
 
 
To solve this, we will use a Projected Coordinate System (PCS) instead. A PCS “projects” or converts the data in a way that makes allowance for the scale change and corrects it. Therefore, to keep the scale constant, we should reproject our data to use a PCS.
 
 
 
=== [[Image:basic17.png|image]] Follow along: “On the Fly” Reprojection ===
 
 
 
QGIS allows you to reproject data “on the fly”. What this means is that even if the data itself is in another CRS, QGIS can project it as if it were in a CRS of your choice.
 
 
 
* To enable “on the fly” projection, click on the ''CRS Status'' button in the ''Status Bar'' along the bottom of the QGIS window:
 
 
 
<span>[[Image:0017.png|image]]</span>
 
 
 
* In the dialog that appears, check the box next to ''Enable ‘on the fly’ CRS transformation''.
 
* Type the word <span><code>global</code></span> into the ''Filter'' field. One CRS (''NSIDC EASE-Grid Global'') will appear in the list below.
 
* Click on it to select it, then click <span><code>OK</code></span>.
 
* Notice how the shape of Indonesia changes. All projections work by changing the apparent shapes of objects on Earth.
 
* Zoom in to a scale of <span><code>1:5000000</code></span> again, as before.
 
* Pan around the map.
 
* Notice how the scale stays the same!
 
 
 
“On the fly” reprojection is also used for combining datasets that are in different CRSs.
 
 
 
* Deactivate “on the fly” reprojection again:
 
** Click on the ''CRS Status'' button again.
 
** Uncheck the ''Enable ‘on the fly’ CRS transformation'' box.
 
** Clicking ''OK''.
 
* Add another vector layer to your map which has the data for Indonesia only. You will find it as <span><code>exercise_data/world/Indonesia_regions_32750.shp</code></span>.
 
 
 
What do you notice?
 
 
 
The layer is not visible! But that is easy to fix, right?
 
 
 
* Right-click on the layer in the ''Layers list''.
 
* Select ''Zoom to Layer Extent''.
 
 
 
So now we see Indonesia... but where is the rest of the world?
 
 
 
It turns out that we can zoom between these two layers, but we can not ever see them at the same time. That is because their Coordinate Reference Systems are so different. The ''continents'' dataset is in ''degrees'', but the ''Indonesia_regions_32750'' dataset is in ''meters''. So, let us say that a given point in Jakarta in the ''Indonesia_regions_32750'' dataset is about <span><code>620 000</code></span> meters away from the equator. But in the ''continents'' dataset, that same point is about <span><code>6.3</code></span> degrees away from the equator.
 
 
 
This is the same distance - but QGIS doesn’t know that. You haven’t told it to reproject the data. So as far as it’s concerned, the version of Indonesia that we see in the ''Indonesia_regions_32750'' dataset has Jakarta at the correct distance of <span><code>620 000</code></span> meters from the equator. But in the ''continents'' dataset, Jakarta is only <span><code>6.3</code></span> ''meters'' away from the equator! You can see why this is a problem.
 
 
 
QGIS does not know where Jakarta is ''supposed'' to be - that is what the data should be telling it. If the data tells QGIS that Jakarta is <span><code>6.3</code></span> meters away from the equator and that Indonesia is only about <span><code>12</code></span> meters from north to south, then that is what QGIS will draw.
 
 
 
To correct this:
 
 
 
* Switch ''Enable ‘on the fly’ CRS transformation'' on again as before.
 
* Zoom to the extents of the ''Indonesia_regions_32750'' dataset.
 
 
 
Now, because they are made to project in the same CRS, the two datasets fit perfectly:
 
 
 
<span>[[Image:0028.png|image]]</span>
 
 
 
When combining data from different sources, it is important to remember that they might not be in the same CRS. “On the fly” reprojection helps you to display them together.
 
 
 
=== [[Image:moderate17.png|image]] Follow along: Saving a Dataset to Another CRS ===
 
 
 
We have shown how using “On the fly” can make layers with different projections appear on the same map. But how can we reproject the layers so they are the same projection?
 
 
 
To truly reproject the data itself, you need to export it to a new file using a new projection.
 
 
 
Our layer ''Indonesian_regions_32750'' is projected using the CRS WGS 84 / UTM zone 50S, which is correct for most of Indonesia. What we will do now is reproject this layer so it is the same as our ''continents'' layer.
 
 
 
* Right-click on the ''Indonesian_regions_32750''
 
* Click on ''Save as''
 
* A new window ''Save vector layer as...'' will appear
 
* Click on the ''Browse'' button next to the ''Save as'' field
 
* Navigate to your <span><code>exercise_data/</code></span> folder, and call your new file <span><code>Indonesia_regions_WGS84.shp</code></span>
 
* Leave the ''Encoding'' unchanged.
 
* Change the value of the ''Layer CRS'' dropdown to ''Selected CRS''.
 
* Click the ''Browse'' button beneath the dropdown.
 
* The ''CRS Selector'' dialog will now appear.
 
* In its ''Filter'' field, search for <span><code>33S</code></span>.
 
* Choose ''WGS 84 EPSG:4326'' from the list.
 
* Click ''OK''.
 
 
 
The ''Save vector layer as...'' dialog now looks like this:
 
 
 
<span>[[Image:0046.png|image]]</span>
 
 
 
* Click ''OK'' and after an instant, you should be presented with:
 
 
 
<span>[[Image:0058.png|image]]</span>
 
 
 
* Click ''OK''.
 
 
 
Now both layers have the same projection and are displayed correctly, without the need for “On the fly”.
 
 
 
Both the layers are now projected in degrees. If you want to measure distance using units of length such as meters or kilometers, you will need to project the layers accordingly, using a different PCS.
 
 
 
<span>note</span><span>Note:</span> It is very important to remember that to reproject a layer, you must save it as a new layer, with the new projection. You can not correctly change the projection of a layer using any other way.
 
 
 
=== In conclusion ===
 
 
 
Different projections are useful for different purposes. By choosing the correct projection, you can ensure that the features on your map are being represented accurately.
 
 
 
<span>[[Image:0067.png|image]]</span>
 
 
 
=== In conclusion ===
 
 
 
Different projections are useful for different purposes. By choosing the correct projection, you can ensure that the features on your map are being represented accurately.
 
 
 
=== Further reading ===
 
 
 
Further information on Coordinate Reference Systems is available [http://linfiniti.com/dla/worksheets/7_CRS.pdf here]<ref>http://linfiniti.com/dla/worksheets/7_CRS.pdf
 
</ref>.
 
 
 
=== What’s next? ===
 
 
 
In the next lesson you’ll learn how to analyze vector data using QGIS’ various vector analysis tools.
 
 
 
== Lesson: Vector Analysis ==
 
 
 
[vector<sub>a</sub>nalysis/basic<sub>a</sub>nalysis:ls-vector-analysis] Vector data can also be analyzed to reveal how different features interact with each other in space. There are many different analysis-related functions in GIS, so we won’t go through them all. Instead, we will show show you the tools QGIS provides to solve a realistic problem you might face.
 
 
 
<span>note</span><span>Note:</span> For this lesson we are going to use the original exercise and data, which is based in South Africa. You will have the opportunity in Chapter 9, ''Using QGIS in animal health'', to use GIS for a specific animal health exercise using Indonesian data from iSIKHNAS.
 
 
 
'''The goal for this lesson:''' To ask a question and solve it using analysis tools.
 
 
 
=== [[Image:basic17.png|image]] The GIS Process ===
 
 
 
Before we start, it would be useful to give a brief overview of a process that can be used to solve any GIS problem. The way to go about it is:
 
 
 
# State the Problem
 
# Get the Data
 
# Analyze the Problem
 
# Present the Results
 
 
 
=== [[Image:basic17.png|image]] The problem ===
 
 
 
We begin the process by deciding on a problem to solve. Let us say you are a property developer, and you need to buy a farm to build a new residential development for people who have had enough of Cape Town and Johannesburg. You have done some market research, and you have come up with the following requirements that a farm needs to satisfy:
 
 
 
# It needs to be in Swellendam.
 
# You don’t want to have to build a long access road (maximum distance 500 meters), and it has to be easily accessible from main routes.
 
# The people who make up the target market will probably have children, so it must be within a reasonable distance (by car) from a school.
 
# The farm must be between 100 and 150 hectares in area.
 
 
 
=== [[Image:basic17.png|image]] The data ===
 
 
 
To answer these questions, we are going to need the following data:
 
 
 
# The farms we’re going to be choosing from.
 
# The roads that need to be running through these farms.
 
# The location of schools.
 
 
 
For this exercise the data has been provided already, but in reality you may need to find a provider for the datasets in question.
 
 
 
=== [[Image:basic17.png|image]] Follow along: Start a Project ===
 
 
 
So now that we know what we want to do, let’s start doing it!
 
 
 
* Start a new QGIS project.
 
* Start adding new layers. They’re all to be found in the <span><code>exercise_data/projected_data</code></span> folder.
 
* Add the <span><code>schools_33S</code></span>, <span><code>roads_33S</code></span> and <span><code>farms_33S</code></span> layers.
 
 
 
These files are in a Projected Coordinate System, which is necessary for this analysis, for reasons we have covered in the previous lesson. (We want to be able to calculate distances in meters and areas in hectares, not in degrees.)
 
 
 
Once you have got these layers in your ''Layers list'':
 
 
 
* Rename the layers by right-clicking on them and selecting the ''Rename'' option.
 
* Give them the new, less messy names <span><code>roads</code></span>, <span><code>schools</code></span> and <span><code>farms</code></span>.
 
* Save your map under ''exercise_data'', as <span><code>analysis.qgs</code></span>.
 
* In your operating system’s file manager, create a new folder under ''exercise_data'' and call it <span><code>residential_development</code></span>. This is where you’ll save the datasets that will be the results of the analysis functions.
 
 
 
Now that we’ve got the data, we can analyze the problem.
 
 
 
=== [[Image:basic17.png|image]] Follow along: Analyzing the Problem: Farms in Swellendam ===
 
 
 
The first criterion we are facing is that the farm needs to be in Swellendam. So let’s tell QGIS to only show us the farms that are, in fact, in Swellendam.
 
 
 
* Right-click on the ''farms'' layer in the ''Layers list''.
 
* Select the option ''Query...''. This gives you a new ''Query Builder'' dialog.
 
* Scroll down in the ''Fields'' list on the left of this dialog until you see the field <span><code>TOWN</code></span>.
 
* Click on it once.
 
* Click the ''All'' button underneath the ''Values'' list:
 
 
 
<span>[[Image:0138.png|image]]</span>
 
 
 
Now we need to tell QGIS to only show us the farms where the value of <span><code>TOWN</code></span> is equal to <span><code>Swellendam</code></span>.
 
 
 
* Double-click the word <span><code>TOWN</code></span> in the ''Fields'' list.
 
* Watch what happens in the ''SQL where clause'' field below:
 
 
 
<span>[[Image:0148.png|image]]</span>
 
 
 
The word <span><code>TOWN</code></span> has appeared! To build the rest of the query:
 
 
 
* Click the ''='' button (under ''Operators'').
 
* Double-click the value <span><code>Swellendam</code></span> in the ''Values'' list.
 
 
 
Your query is this:
 
 
 
<span>[[Image:0155.png|image]]</span>
 
 
 
And now your ''farms'' layer looks like this:
 
 
 
<span>[[Image:0167.png|image]]</span>
 
 
 
For further analysis, it’s better if we’ve got these farms as a separate layer.
 
 
 
* Right-click on the ''farms'' layer and click ''Save As...''.
 
* Next to the ''Save as'' field in the dialog that appears, click the ''Browse'' button.
 
* Save the layer under <span><code>exercise_data/residential_development/</code></span>, as <span><code>swellendam_farms.shp</code></span>.
 
* Check the ''Add saved file to map'' box in the ''Save vector layer as...'' dialog.
 
* Click ''OK''. It will tell you that <span><code>Export to vector file has been completed</code></span>.
 
* Click ''OK''.
 
 
 
Now we’ve got the ''farms'' twice, but we only need the one we just created.
 
 
 
* Right-click on the old ''farms'' layer and remove it.
 
 
 
=== [[Image:basic17.png|image]] Try yourself... find important roads ===
 
 
 
[vector<sub>a</sub>nalysis/basic<sub>a</sub>nalysis:backlink-vector-analysis-basic-1] We have a similar problem with the roads; the only roads we’re taking into account are the main ones.
 
 
 
<ul>
 
<li><p>Build a query for the ''roads'' layer, like you did above for the ''farms'' layer. You want only the types <span><code>primary</code></span>, <span><code>secondary</code></span>, <span><code>tertiary</code></span> and <span><code>trunk</code></span>, so you need to build this query:</p>
 
<p><span><code>TYPE = ’primary’ OR TYPE = ’secondary’ OR TYPE = ’tertiary’ OR TYPE = ’trunk’</code></span></p></li></ul>
 
 
 
You can either use the approach above, where you double-clicked values and clicked buttons, or you can copy and paste the command above.
 
 
 
=== [[Image:basic17.png|image]] Try yourself... find high schools ===
 
 
 
Your future customers will want to send their children to high schools.
 
 
 
<ul>
 
<li><p>Use the same approach as before and build this query for the ''schools'' layer:</p>
 
<p><span><code>has_high_s = ’y’</code></span></p></li></ul>
 
 
 
You should have only 3 out of the 4 original schools left.
 
 
 
* Save the resulting layer under <span><code>exercise_data/residential_development/</code></span> as <span><code>high_schools.shp</code></span>.
 
 
 
=== [[Image:basic17.png|image]] Follow along: Analyzing the Problem: Distances From Schools and Roads ===
 
 
 
QGIS allows you to calculate distances from any vector object.
 
 
 
* Make sure that only the ''important_roads'' and ''swellendam_farms'' layers are visible, to simplify the map while you’re working.
 
* Click on the ''Vector <math>\rightarrow</math> Geoprocessing Tools <math>\rightarrow</math> Buffer(s)'' tool:
 
 
 
<span>[[Image:0187.png|image]]</span>
 
 
 
This gives you a new dialog.
 
 
 
* Set it up like this:
 
 
 
<span>[[Image:0208.png|image]]</span>
 
 
 
The ''Buffer distance'' is in meters because our input dataset is in a Projected Coordinate System. This is why we needed to use projected data!
 
 
 
* Save the resulting layer under <span><code>exercise_data/residential_development/</code></span> as <span><code>important_roads_buffer_500m.shp</code></span>.
 
* Click ''OK'' and it will create the buffer.
 
* When it asks you if it should “add the new layer to the TOC”, click ''Yes''. (“TOC” stands for “Table of Contents”, by which it means the ''Layers list'').
 
* Now click on ''Close'' on the dialog box.
 
 
 
Now you’ve got this:
 
 
 
<span>[[Image:0217.png|image]]</span>
 
 
 
OK, that looks interesting! Those are all the areas that are within 500 meters of an important road.
 
 
 
But look closer: it looks like there are joins between different sections of road! That is not nice. Remove that layer and let us try again:
 
 
 
<span>[[Image:0226.png|image]]</span>
 
 
 
* Note that we’re now checking the ''Dissolve buffer results'' box.
 
* Save the output under the same name as before (click ''Yes'' when it asks your permission to overwrite the old one).
 
* Click ''OK''.
 
 
 
Once you’ve added the layer to the ''Layers list'', it will look like this:
 
 
 
<span>[[Image:0238.png|image]]</span>
 
 
 
That’s more like it! Now there are no unnecessary subdivisions.
 
 
 
=== [[Image:basic17.png|image]] Try yourself... distance from high schools ===
 
 
 
[vector<sub>a</sub>nalysis/basic<sub>a</sub>nalysis:basic-ty-distance-from-high-schools]
 
 
 
* Use the same approach as above and create a buffer for your schools.
 
 
 
It needs to be <span><code>10 km</code></span> in radius, and saved under the usual directory as <span><code>high_schools_buffer_10km.shp</code></span>.
 
 
 
=== [[Image:basic17.png|image]] Follow along: Overlapping Areas ===
 
 
 
Now we have areas where the road in 500 meters away and there’s a school within 10 km (as the crow flies). But obviously, we only want the areas where both of these criteria are satisfied at once! To do that, we’ll need to use the ''Intersect'' tool. Find it under ''Vector <math>\rightarrow</math> Geoprocessing Tools <math>\rightarrow</math> Intersect''. Set it up like this:
 
 
 
<span>[[Image:0278.png|image]]</span>
 
 
 
The two input layers are the two buffers; the save location is as usual; and the file name is <span><code>road_school_buffers_intersect.shp</code></span>. Once it’s set up like this, click ''OK'' and add the layer to the ''Layers list'' when prompted.
 
 
 
In the image below, the blue areas show us where both distance criteria are satisfied at once!
 
 
 
<span>[[Image:0287.png|image]]</span>
 
 
 
You may remove the two buffer layers and only keep the one that shows where they overlap, since that’s what we really wanted to know in the first place.
 
 
 
=== [[Image:basic17.png|image]] Follow along: Select the Farms ===
 
 
 
[vector<sub>a</sub>nalysis/basic<sub>a</sub>nalysis:basic-fa-select-the-farms] Now you’ve got the area that the farms must overlap. Next, you want to select the farms in that area.
 
 
 
* Click on the menu entry ''Vector <math>\rightarrow</math> Research Tools <math>\rightarrow</math> Select by location''. A dialog will appear.
 
* Set it up like this:
 
 
 
<span>[[Image:0305.png|image]]</span>
 
 
 
* Click ''OK'' and you’ll see the results:
 
 
 
<span>[[Image:0312.png|image]]</span>
 
 
 
The yellow farms are the selected ones. Let’s save them as a new layer.
 
 
 
* Right-click on the ''swellendam_farms'' layer in the ''Layers list''.
 
* Select ''Save Selection As...''.
 
* Set the dialog up like this:
 
 
 
<span>[[Image:0322.png|image]]</span>
 
 
 
* The file name is <span><code>well_located_farms.shp</code></span>.
 
* Click ''OK''.
 
 
 
Now you have the selection as a separate layer.
 
 
 
=== [[Image:basic17.png|image]] Follow along: Select Farms of the Right Size ===
 
 
 
To see which farms are the right area (between 100 and 150 ha), we first need to calculate their areas in hectares.
 
 
 
* Open the attribute table for the ''well_located_farms'' layer.
 
* Enter edit mode:
 
 
 
<span>[[Image:0331.png|image]]</span>
 
 
 
* Start the field calculator:
 
 
 
<span>[[Image:0344.png|image]]</span>
 
 
 
* Set it up like this:
 
 
 
<span>[[Image:0353.png|image]]</span>
 
 
 
* If you can not find ''AREA'' in the list, try this instead:
 
 
 
<span>[[Image:0363.png|image]]</span>
 
 
 
* Click ''OK''.
 
* Scroll to the right of the attribute table; your <span><code>AREA</code></span> field now has areas in hectares for all the farms in your ''well_located_farms'' layer.
 
* Click the edit mode button again as above, and save your edits when prompted.
 
* Do a query:
 
 
 
<span>[[Image:0373.png|image]]</span>
 
 
 
* Click ''OK''. Your results should look like this:
 
 
 
<span>[[Image:0381.png|image]]</span>
 
 
 
That’s it! Those red farms are the ones satisfying your criteria. Well done!
 
 
 
=== [[Image:basic17.png|image]] Try yourself... ===
 
 
 
* Save your solution as a new layer, using the approach you learned above for doing so. The file should be saved under the usual directory, with the name <span><code>solution.shp</code></span>.
 
 
 
=== In conclusion ===
 
 
 
Using the GIS problem-solving approach together with QGIS vector analysis tools, you were able to solve a problem with multiple criteria quickly and easily.
 
 
 
=== What’s next? ===
 
 
 
In the next lesson, we will look at Plugins, and how they can help you with your mapping tasks.
 
 
 
= Module: Plugins =
 
 
 
[qgis<sub>p</sub>lugins/index::doc] Plugins allow you to extend the functionality QGIS offers. In this module, you’ll be shown how to activate and use plugins.
 
 
 
== Lesson: Installing and Managing Plugins ==
 
 
 
[qgis<sub>p</sub>lugins/fetching<sub>p</sub>lugins::doc] To begin using plugins, you need to know how to download, install and activate them. To do this, you will learn how to use the ''Plugin Installer'' and ''Plugin Manager''.
 
 
 
'''The goal for this lesson:''' To understand and use QGIS’ plugin system.
 
 
 
=== [[Image:basic15.png|image]] Follow along: Managing Plugins ===
 
 
 
* To open the ''Plugin Manager'', click on the menu item ''Plugins <math>\rightarrow</math> Manage Plugins''.
 
* The following dialog will open, showing the different plugins already installed
 
 
 
in your QGIS software. What you see may differ slightly to the image below, depending upon what plugins you have installed:
 
 
 
<blockquote><span>[[Image:0057.png|image]]</span>
 
</blockquote>
 
You can activate or deactivate these plugins by clicking on their corresponding check box.
 
 
 
The list of plugins that you can activate and deactivate only draws from the plugins that you currently have installed. To install new plugins, you need to use the ''Plugin Installer''.
 
 
 
=== [[Image:basic15.png|image]] Follow along: Installing New Plugins ===
 
 
 
* To start the ''Plugin Installer'', click on the menu item ''Plugins <math>\rightarrow</math> Fetch Python Plugins''.
 
 
 
A dialog will appear. The amount of plugins that you see here will differ, depending on your setup.
 
 
 
QGIS plugins are stored online in repositories. By default, only the official repositories are active, meaning that you can only access official plugins. These are usually the first plugins you want, because they have been tested thoroughly and are often included in QGIS by default.
 
 
 
It is possible, however, to try out more plugins than the default ones. To do this:
 
 
 
<ul>
 
<li><p>Open the ''Options'' tab on the ''Plugin Installer'' dialog:</p>
 
<p><span>[[Image:0027.png|image]]</span></p></li>
 
<li><p>Click the ''Show all plugins except those marked as experimental'' option.</p></li></ul>
 
 
 
If you want to, you can click on the ''Show all plugins, even those marked as experimental'' option. Be aware that experimental plugins may not be fully tested.
 
 
 
<ul>
 
<li><p>Now go back to the ''Plugins'' tab to find the available plugins.</p>
 
<p><span>[[Image:0037.png|image]]</span></p></li>
 
<li><p>To install a plugin, simply click on it in the list and then click the ''Install plugin'' button.</p></li></ul>
 
 
 
=== In conclusion ===
 
 
 
Installing plugins in QGIS is simple.
 
 
 
=== What’s next? ===
 
 
 
Next we will introduce you to some useful plugins as examples.
 
 
 
== Lesson: Useful QGIS Plugins ==
 
 
 
[qgis<sub>p</sub>lugins/plugin<sub>e</sub>xamples:ls-useful-qgis-plugins] Now you can install, enable and disable plugins. Let’s see how this can help you in practice by looking at some examples of useful plugins.
 
 
 
'''The goal for this lesson:''' To familiarize yourself with the plugin interface and get acquainted with some useful plugins.
 
 
 
=== [[Image:basic15.png|image]] Follow along: The OpenLayers Plugin ===
 
 
 
<ul>
 
<li><p>Start a new map with only the ''streets'' layer in it.</p></li>
 
<li><p>Using the ''Plugin Installer'', find the plugin by entering the word <span><code>Open</code></span> in the ''Filter'' field.</p></li>
 
<li><p>Select the Google Layers plugin from the filtered list:</p>
 
<p><span>[[Image:0206.png|image]]</span></p></li>
 
<li><p>Click the ''Install plugin'' button to install.</p></li>
 
<li><p>When it’s done, close the ''Plugin Installer''.</p></li>
 
<li><p>Open the ''Plugin Manager''.</p></li>
 
<li><p>Enable the new plugin:</p>
 
<p><span>[[Image:0216.png|image]]</span></p></li>
 
<li><p>Check the box beside it.</p></li>
 
<li><p>Now click ''OK'' to enable the plugin.</p></li></ul>
 
 
 
To use the plugin:
 
 
 
<ul>
 
<li><p>Open the plugin by clicking on ''Plugins <math>\rightarrow</math> Open Layers <math>\rightarrow</math> Settings''.</p></li>
 
<li><p>Use the dialog to choose a map type you want. In this example, we’ll use the “Add Google Satellite Layer” type map, but you can choose any others if you want.</p></li>
 
<li><p>Enable “on the fly” projection and use the Google Mercator projection:</p>
 
<p><span>[[Image:0236.png|image]]</span></p></li></ul>
 
 
 
You should now have a new raster image in from Google that you can use as a backdrop, or to help you find out where you are on the map. Here is such a layer, with our own vector road layer as overlay:
 
 
 
<span>[[Image:0247.png|image]]</span>
 
 
 
=== [[Image:moderate15.png|image]] Follow along: The OpenStreetMap Plugin ===
 
 
 
Since we’re using OpenStreetMap (OSM) data in our examples, it would be instructive to know where it comes from. QGIS has a plugin that allows you to download and edit this kind of data easily.
 
 
 
<ul>
 
<li><p>First, ensure that you have the plugin installed by opening the ''Plugin Installer'' and filtering on the word <span><code>street</code></span>:</p>
 
<p><span>[[Image:0066.png|image]]</span></p></li>
 
<li><p>The ''OpenStreetMap plugin'' should be installed by default, but if it isn’t, you can get it by clicking the ''Install plugin'' button.</p></li>
 
<li><p>Once it’s installed, activate it via the ''Plugin Manager''.</p></li>
 
<li><p>A new buttons and, if activated in ''View <math>\rightarrow</math> Panels <math>\rightarrow</math> OSM Feature'', a new panel will be added to your interface:</p>
 
<p><span>[[Image:0077.png|image]]</span></p></li></ul>
 
 
 
Let us download data for Bandung. The plugin will download data for the area currently on your map.
 
 
 
<ul>
 
<li><p>Zoom in to the Bandung area.</p></li>
 
<li><p>To add data, click on the ''Download OSM data'' button:</p>
 
<p><span>[[Image:0087.png|image]]</span></p></li></ul>
 
 
 
<span>note</span><span>Note:</span> You may see a message stating that the latitude, longitude, or both extents are too large. This is because the OSM server doesn’t have the capacity to continually give people data about the whole world. To prevent people trying to download too much data, there’s a limit to the size of the area for which you can download data. If you get one of these error messages, zoom in to a smaller area on the map.
 
 
 
<ul>
 
<li><p>If you have an acceptable area, you can leave the other options as default and click the ''Download'' button.</p></li>
 
<li><p>After a while, the data will be downloaded, and will be shown in your map automatically. Here’s an example:</p>
 
<p><span>[[Image:0115.png|image]]</span></p></li></ul>
 
 
 
With any of the OSM layers selected in your ''Layers list'', the buttons in the plugin’s dock panel will become active:
 
 
 
<span>[[Image:0125.png|image]]</span>
 
 
 
<ul>
 
<li><p>Using the plugin’s own ''Identify feature'' tool (at the far left of the above buttons), click on any feature in the OSM layers to retrieve its data and see it displayed in the plugin interface. For example, clicking on the polygon near the top of the screen in our example shows it is a golf course:</p>
 
<p><span>[[Image:0136.png|image]]</span></p></li>
 
<li><p>You can create new features (point, lines, polygons) as well as edit a feature that you have identified. For example, using the plugin’s ''Identify feature'' tool as before, you can click on this polygon and see that it is a forest without a name:</p>
 
<p><span>[[Image:0146.png|image]]</span></p></li></ul>
 
 
 
<ul>
 
<li><p>Double-click in the ''&lt;new tag here&gt;'' field.</p></li>
 
<li><p>Select a new tag (attribute) from a list. Let’s choose ''name'':</p>
 
<p><span>[[Image:0165.png|image]]</span></p></li>
 
<li><p>Double-click in the ''Value'' field:</p>
 
<p><span>[[Image:0176.png|image]]</span></p></li></ul>
 
 
 
You can now enter a name for the forest. You can save your changes to the original source data, too. This makes the changes available internationally on the OSM server.
 
 
 
<ul>
 
<li><p>Click the ''Upload OSM data'' button:</p>
 
<p><span>[[Image:0185.png|image]]</span></p>
 
<p>This gives you a dialog, which you can fill in as needed.</p></li>
 
<li><p>If you have a user account at OSM, you can enter your credentials in the spaces provided and click the ''Upload'' button to save those changes.</p></li></ul>
 
 
 
Note that the plugin has many other functions: for example, you can also save OSM layers to a local directory, load data from saved OSM layers, and export OSM data as shapefiles.
 
 
 
OSM’s data comes from, and is maintained by, the efforts of their users. Contributing data using this plugin allows you to help improve the quality of the OSM data you depend on.
 
 
 
=== In conclusion ===
 
 
 
There are many useful plugins available for QGIS. Using the built-in tools for installing and managing these plugins, you can find new plugins and make optimum use of them.
 
 
 
=== What’s next? ===
 
 
 
Now we will look at combining some of the skills you have learnt in a practical exercise involving data from iSIKHNAS.
 
 
 
= Module: Using QGIS in animal health =
 
 
 
[animal<sub>h</sub>ealth/index:mod-using-qgis-in-animal-health] The purpose of this module is to show how QGIS can be used to assist in animal health scenarios. In order to do this, you will have needed to study, and be familiar with, the previous chapters of this manual, but in particular you need to be familiar with chapters 3 - ''Creating a basic map'', and chapter 6 - ''Vector analysis''.
 
 
 
== Lesson: Putting it into practice - iSIKHNAS ==
 
 
 
[animal<sub>h</sub>ealth/exercise1::doc] In this chapter we are going to use some of what you have learned and apply it to data taken from the ISIKHNAS database.
 
 
 
GIS has become an essential tool in the understanding and management of animal movements and disease. It can provide valuable assistance in a range of tasks, including:
 
 
 
# monitoring animal distribution or movements
 
# describing the level and distribution of disease
 
# assessing the efficacy of control programs across space
 
# developing zones for disease control
 
# exploring spatially-linked risk factors
 
# management of animal health emergencies.
 
 
 
This exercise is designed to show you how you can use QGIS in a practical way, using data that you are familiar with.
 
 
 
'''The goal for this lesson:'''
 
 
 
Your supervisor has asked you to identify and extract all the cases in the Sulawesi Selatan region, where the species is a type of poultry, and the syndrome recorded is poultry mortality. S/he would like you to provide a map showing where these cases have occurred, and to create a 15 kilometre buffer around the villages in which they have occurred.
 
 
 
In order to do this you will have to:
 
 
 
* load vector shapefile layers and create a new QGIS project
 
* format the styles appropriately
 
* subset a dataset spatially using ''Select by location''
 
* identify particular records in the attribute table using SQL (structured query language)
 
* save records to a new shapefile
 
* save layers with a projection suitable for spatial exercises
 
* create a buffer zone
 
* use the clip feature to create a layer including only the data required.
 
 
 
For the purpose of these exercises you will be using the shapefiles provided. It is possible to connect directly to the iSIKHNAS database and access the current data however this is beyond the scope of this exercise.
 
 
 
=== [[Image:basic.png|image]] Follow along: Create a new map ===
 
 
 
Open QGIS. Using the ''Add Vector Layer'' button, add the following layers from the course exercise data, from the folder ''ISIKHNAS'':
 
 
 
* <span><code>Sulawesi</code></span>
 
* <span><code>Sul_sthn_dist</code></span>
 
* <span><code>cases_gis</code></span>
 
 
 
Your map will now look something like this:
 
 
 
<span>[[Image:001.png|image]]</span>
 
 
 
The colours will no doubt be different, and probably not suitable. Take the time now to change the style to use the ''Style'' tab in the ''Layer Properties'' to change the colours to those of your choice. As a refresher:
 
 
 
* Right-click on the layer
 
* Select ''Properties''
 
* Click on the ''Style'' tab as described above
 
 
 
Here you can change the formatting of the layer in many ways, including colour, fill, symbols, lines, and more.
 
 
 
<span>[[Image:001a.png|image]]</span>
 
 
 
You can save the colours you choose as styles, so you can easily apply them to other projects.
 
 
 
=== [[Image:basic.png|image]] Try yourself... Saving styles ===
 
 
 
You might want to save a particular colour to be used for your background layer, both in this project and any future mapping projects. To do this, choose the layer you would like to work with, for example <span><code>Sulawesi</code></span>. Open the ''Layer Properties''.
 
 
 
Explore your options. As shown in the above image, there are two ''Change'' buttons.
 
 
 
The first ''Change'' button, with the little spanner, allows you to format items including:
 
 
 
* the symbol layer type
 
* the colour
 
* the fill style
 
* the border colour
 
* the border style
 
* the border width
 
 
 
If you only want to change the colour of the layer, click on the second ''Change'' button.
 
 
 
Once you are happy with your layer style, click on ''Save Style ...''
 
 
 
Save your new style with a name that will make sense to you later, such as <span><code>BaseCountry</code></span>. It is a good idea to save all your styles in the one folder so you can easily find them again.
 
 
 
To use a style you have saved, click on the ''Load Style ...'' button.
 
 
 
We changed our colours of our layers to this:
 
 
 
<span>[[Image:002.png|image]]</span>
 
 
 
There is a very useful website named '''Colorbrewer: Color Advice for Maps''' found here &lt;http://colorbrewer2.org&gt;’ developed by Cynthia Brewer of Penn State. This site contains a lot of useful information about appropriate colour schemes for maps.
 
 
 
Save your work as a new project.
 
 
 
=== [[Image:basic.png|image]] Follow along: Selecting records ===
 
 
 
There are several ways of selecting records from layers, including:
 
 
 
* Select Single Feature
 
* Select Features by Rectangle
 
* Select Features by Polygon
 
* Select Features by Freehand
 
* Select Features by Radius
 
 
 
This are found by clicking on the ''Select Features by Polygon'' button, and referring to the drop down menu.
 
 
 
<span>[[Image:003.png|image]]</span>
 
 
 
This is a useful tool for selecting one or two features, or quickly drawing around an area. When we want to be more accurate, we can use the ''Select by Location'' tool.
 
 
 
To find the ''Select by Location'' tool, click on the menu ''Vector - Research Tools - Select by location'':
 
 
 
<span>[[Image:004.png|image]]</span>
 
 
 
By selecting features of one layer that intersect with another, we can create a new layer containing just the features we are interested in.
 
 
 
=== [[Image:moderate.png|image]] Follow along: Selecting by location ===
 
 
 
Now that we have our map layers loaded into our project, we would like to work specifically with Sulawesi, and in particular, the cases that have been recorded in the Sulawesi Selatan districts. Currently our map shows all the cases recorded throughout Indonesia at the time the data was downloaded.
 
 
 
Open the ''Select by Location''. We want to select the features in the <span><code>cases_gis</code></span> file that intersect with the <span><code>Sul_sthn_dist</code></span> file:
 
 
 
<span>[[Image:005.png|image]]</span>
 
 
 
Click ‘OK’ and check your map. You should see that the cases that occur in Sulawesi Selatan are now highlighted:
 
 
 
<span>[[Image:006.png|image]]</span>
 
 
 
Save this selection as a new layer by right-clicking on the <span><code>cases_gis</code></span> layer, and then clicking on ''Save Selection As...'':
 
 
 
<span>[[Image:007.png|image]]</span>
 
 
 
Save your new layer as <span><code>Sul_sthn_cases</code></span> and add it to your map. If you feel the need, format the colour.
 
 
 
You can now remove the <span><code>cases_gis</code></span> layer.
 
 
 
=== [[Image:basic.png|image]] Follow along: Inspect the data ===
 
 
 
As mentioned above, you need to extract all the cases of poultry mortality in poultry in the Sulawesi Selatan region. How would you go about doing that?
 
 
 
One answer lies in a layer’s ''Attribute Table''. Here you are able to see much more information about each record in the layer. The ''Attribute Table'' has been mentioned earlier, particularly in Chapters 3 and 4. Now we are going to use the information contained in the attribute table to select the records we require.
 
 
 
When we open the ''Attribute Table'' for the <span><code>Sul_sthn_cases</code></span> layer, we see several columns showing information about each record:
 
 
 
<span>[[Image:008.png|image]]</span>
 
 
 
What information do you notice?
 
 
 
In this example we can see there are 1728 records in total in this layer. The attribute table has columns containing the following information:
 
 
 
* gid (Geographic identification)
 
* reportdate
 
* caseid
 
* species
 
* cases
 
* reporttype
 
* syndrome2
 
* reporter
 
* desa
 
 
 
We can use this screen to find (for example) all the records relating to chickens by typing in ''chicken'' in the ''Look for'' box, choosing ''species'' in the drop down box and clicking on ''Search''. Immediately, all the records with chicken recorded as the species are highlighted in the attribute table.
 
 
 
<span>note</span><span>Note:</span> Notice the ''Case sensitive'' option. It is best to leave this box unticked.
 
 
 
That way your search will return results for ''Chicken'' and ''chicken,'' and any other variations of sentence case.
 
 
 
However, we do not want just chickens, we want all poultry that are recorded with ''poultry mortality'' as the syndrome. To select these records, we need to use the ''Advanced search'' features.
 
 
 
=== [[Image:moderate.png|image]] Follow along: Selecting records using SQL (Simple Query Language) ===
 
 
 
The ''Advanced search features'' allow us to create more specific queries, selecting records with the particular attributes we are interested in.
 
 
 
<span>[[Image:009.png|image]]</span>
 
 
 
Our query is asking for all the records that contain chicken or duck or local chicken as the species, '''and''' a value of ‘poultry mortality’ in the syndrome2 table.
 
 
 
By testing the query, we find that we have 11 matching records:
 
 
 
<span>[[Image:010.png|image]]</span>
 
 
 
Click ''OK'' in the window saying ''Found 11 matching feature(s),'' and click ''OK'' in the ‘Search query builder’ window. Note that at the top of the attribute table you will now see the heading ''Attribute table - Sul_cases_sthn (11 matching features)''. Click ''Close'' on the attribute table.
 
 
 
Now that we have our records selected, we will use the ''Save selection as'' option that we used before, and save this layer to our map. Right-click on the <span><code>Sul_sthn_cases</code></span> layer, and click on ''Save selection as.''
 
 
 
<span>[[Image:011.png|image]]</span>
 
 
 
Name this new layer <span><code>Cases_PoultryMortality</code></span> and add it to your map.
 
 
 
By turning off the <span><code>Sul_sthn_cases</code></span> layer, we can now see the records in the database of poultry mortality recorded in poultry in Sulawesi Selatan.
 
 
 
<span>[[Image:012.png|image]]</span>
 
 
 
<span>note</span><span>Note:</span> We have used the ''Advanced Labeling'' tool referred to in Section 4.2.1 ''Using labels'' to show the labels of each of the districts.
 
 
 
Save your project.
 
 
 
=== [[Image:moderate.png|image]] Try yourself... Selection using SQL ===
 
 
 
Using the ''Advanced search'' features in the ''Attribute table'' for the <span><code>Sul_sthn_cases</code></span> layer, try selecting specific records according to various combinations.
 
 
 
Do not be afraid to experiment. Try selecting records different combinations such as the date, village, species, syndrome etc.
 
 
 
=== In conclusion ===
 
 
 
There are several ways available for selecting data. Which method you choose will depend upon your needs.
 
 
 
Using SQL queries enables you to select records according to the particular attributes that are of interest to you.
 
 
 
=== What’s next? ===
 
 
 
Now you have your basic map showing where the cases of interest are located. In our next lesson we will review why we are going to need to project our layers in order to develop suitable buffers.
 
 
 
== Lesson: Projecting layers ==
 
 
 
[animal<sub>h</sub>ealth/exercise2::doc] We have created a map showing all the cases of poultry mortality in the Sulawesi Selatan region. Now we need to consider our approach to creating the required 15 kilometre buffer zone around these cases.
 
 
 
'''The goal for this lesson:'''
 
 
 
To review map projections
 
 
 
=== [[Image:basic.png|image]] Follow along: Projecting the layers ===
 
 
 
Think back to Chapter 7 where you learnt about projections, and now take a look at the layers on your map. Is their CRS (Coordinate Reference System) a Geographic Coordinate Reference System (GCS) or a Projected Coordinate System (PCS)? How can you tell?
 
 
 
The easiest way is to check the ''Coordinate'' box at the bottom of the map canvas. It should be showing longitude and latitude values in decimal degrees, separated by a comma e.g. 120.723,-4.971.
 
 
 
To find even more detail about a layer’s CRS, right-click on the layer, and go to ''Properties'', then click on the ''General'' tab you will see that the CRS is EPSG:4326 - WGS 84. Even greater detail is seen when you click on the ''Metadata'' tab.
 
 
 
<span>[[Image:013.png|image]]</span>
 
 
 
As a general rule, if you are going to manipulate spatial data using tools from the ''Vector'' menu, your layers will need to be projected to a format where distance is expressed in measurement units such as metres.
 
 
 
For this exercise we will use the Universal Transverse Mercator (UTM) zone 50s (EPSG 32750).
 
 
 
* Right-click on the <span><code>Cases_PoultryMortality</code></span> layer in the ''Layers list''.
 
* Select ''Save As...'' in the menu that appears. You will be shown the ''Save vector layer as...'' dialog.
 
* Click on the ''Browse'' button next to the ''Save as'' field.
 
* Navigate to the folder you have nominated to store your exercise data and specify the name of the new layer as <span><code>PoultryMortality_32750.shp</code></span>.
 
* Leave the ''Encoding'' unchanged.
 
* Click the ''Browse'' button beneath the dropdown.
 
* The ''CRS Selector'' dialog will now appear.
 
* In its ''Filter'' field, search for <span><code>32750</code></span>.
 
* Choose ''WGS 84 / UTM zone 50S'' from the list.
 
* Click ''OK''.
 
 
 
=== [[Image:basic.png|image]] Try yourself... Project the remaining layers ===
 
 
 
Repeat these steps for your remaining layers, adding the new, projected layers to your map. You can now remove the original, unprojected layers from your map. As we have determined that we are only using maps from the areas in Sulawesi Selatan, you no longer need your <span><code>Sulawesi</code></span> layer.
 
 
 
The option to project ''On the fly'' should be turned off.
 
 
 
Your map should now look something like this:
 
 
 
<span>[[Image:014.png|image]]</span>
 
 
 
Note the ''Coordinate'' box shows the units in metres instead of degrees.
 
 
 
Save your project.
 
 
 
== Lesson: Buffering ==
 
 
 
[animal<sub>h</sub>ealth/exercise3:ls-buffering] Now we have have our layers necessary to create our 15 kilometre buffer. Or do we?
 
 
 
'''The goal for this lesson:'''
 
 
 
To consider and understand point data versus polygon data, and how what effect each type will have when creating a buffer zone.
 
 
 
=== [[Image:basic.png|image]] Follow along: Point data, centroids and polygons ===
 
 
 
If you look at your map you will notice that the cases of poultry mortality occur mostly in the districts of Barru and Sinjai.
 
 
 
For this exercise we are going to add a new vector layer, <span><code>VillagePolyBarSin_32750</code></span>, which shows the boundaries of the village polygons in Barru and Sinjai.
 
 
 
Once you have loaded this layer, arrange the layers so the cases are on top of the village boundaries. Look closely at where the cases lie within the village polygons (you may have to zoom in closer on your map).
 
 
 
What do you notice?
 
 
 
<span>[[Image:015.png|image]]</span>
 
 
 
Every case is positioned in the centre of the village boundaries. This suggests they are not the exact coordinates of where the case occurred - all we know is the case occurred somewhere in that particular village. The data is recorded at village level, and it is positioned using the centroid of the village polygon.
 
 
 
How will this affect our 15 kilometre buffer zone? Let’s find out.
 
 
 
=== [[Image:basic.png|image]] Follow along: Buffering from the village centroid ===
 
 
 
For this buffering exercise we will use the <span><code>PoultryMortality_32750</code></span> file we created. Select this layer, and go to the ''Vector'' menu. Hover over ''Geoprocessing Tools'' and select ''Buffer(s)''.
 
 
 
<span>[[Image:016.png|image]]</span>
 
 
 
The following window will open:
 
 
 
<span>[[Image:017.png|image]]</span>
 
 
 
Choose <span><code>PoultryMortality_32750</code></span> as the input vector layer, and use a buffer distance of 15000 (remember your layer units are metres).
 
 
 
Click on ''Dissolve buffer results''.
 
 
 
Click on ''Browse'' and name your new shapefile <span><code>PoultryM15kmBuffer_32750.shp</code></span>.
 
 
 
Add this layer to your map. The result should look something like this:
 
 
 
<span>[[Image:018.png|image]]</span>
 
 
 
Do you see that the buffers naturally extend into the sea? We will now use the '''Clip''' function to fix this.
 
 
 
=== [[Image:basic.png|image]] Follow along: '''Clipping''' datasets ===
 
 
 
We can use one dataset to cut through another dataset, leaving us with only the information we want.
 
 
 
In this case, we are going to clip our new buffer layer with the <span><code>DistrictsSthnSul_32750</code></span> layer that you should have created in section 16.2.2 '''Try yourself... Project the remaining layers'''.
 
 
 
<span>note</span><span>Note:</span> You may have named it differently, such as <span><code>Sul_sth_dist_32750</code></span>.
 
 
 
Again, we move to the ''Vector'' menu, hover over the ''Geoprocessing Tools'', and select ''Clip''.
 
 
 
<span>[[Image:019.png|image]]</span>
 
 
 
Our input layer is the layer we want to change, in this case our new buffer layer. The clip layer is the layer we will use cut around our buffered layer.
 
 
 
Click on the ''Browse'' button, and name your new shapefile <span><code>PoultryM15kmBufferClip_32750.shp</code></span>.
 
 
 
Add it to the map.
 
 
 
Remove the <span><code>PoultryM15kmBuffer_32750.shp</code></span> layer.
 
 
 
Your screen should now look similar to this:
 
 
 
<span>[[Image:020.png|image]]</span>
 
 
 
Our new layer is fitting nicely within the coastlines of South Sulawesi and your supervisor can easily see where the 15 kilometre buffers extend to.
 
 
 
But is this the best buffer zone for the data?
 
 
 
Remember the data suggests the cases are recorded in the database as being in the centre of each village - in reality they are probably taken from anywhere within the village boundary.
 
 
 
This means our 15 kilometre buffers are not going to be as accurate as they might be.
 
 
 
In the next section we will create the buffer using the village polygon layer and compare the two results.
 
 
 
=== [[Image:basic.png|image]] Try yourself... Buffering using the village polygon ===
 
 
 
Using the same skills you have learnt above to buffer and clip layers, create a 15 kilometre buffer zone around the village polygons containing cases of poultry mortality. Clip your new layer and add it to your map, naming it <span><code>PoultryM15kmBufferPolyClip_32750</code></span>.
 
 
 
Rearrange the layers, so that the buffer zone created with the village centroids is visible over the top of your new buffer zone created with the village polygons. What do you notice?
 
 
 
<span>[[Image:021.png|image]]</span>
 
 
 
In this picture, the dark green shows the buffer zone around the village polygons (shown in the light colour). The lighter green shows the buffer zones created using the case data points.
 
 
 
Since we don’t know exactly where each case occurred, it is a good idea to consider using the village polygons when creating a buffer zone, not the village centroids.
 
 
 
=== What’s next? ===
 
 
 
It would be useful if we could estimate by looking at our map how many cases have been recorded in each village. In our next lesson we will review more styling, and how to colour areas according to particular attributes we wish to display.
 
 
 
== Lesson: Styling to show density ==
 
 
 
[animal<sub>h</sub>ealth/exercise4::doc] A good map is able to convey information quickly and clearly. For example, we can use colour to indicate the number of cases in each village of the particular syndrome we are investigating.
 
 
 
'''The goal for this lesson:'''
 
 
 
To review ways of styling our maps so the information is displayed in the clearest possible way.
 
 
 
=== [[Image:basic.png|image]] Follow along: Styling to show density ===
 
 
 
Open the <span><code>PoultrySuddenDeath_32750</code></span> attribute table and have a look at the columns. What do you notice? What information can you easily display on your map?
 
 
 
Take a look at the ''cases'' column. It tells you the number of cases recorded in each village. We can use colour coding to display this information on our map.
 
 
 
To do this, open the layer properties for <span><code>PoultrySuddenDeath_32750</code></span> and click on the ''Style'' tab.
 
 
 
Select ''Graduated'' from the pull-down rendering menu. This spreads our chosen colours from light to dark, or dark to light.
 
 
 
Set the ''Column'' to ''cases'', and the ''Classes'' to 5.
 
 
 
The ''Color ramp'' can stay at blue for now, and the ''Mode'' can be set to ''Equal Interval''. QGIS should immediately provide a set of five blue colours, with five equally spaced intervals. (If not, click on ''Classify'').
 
 
 
Click on ''Apply'' to see how this looks on your map.
 
 
 
What do you notice?
 
 
 
<span>[[Image:022.png|image]]</span>
 
 
 
Our points on the map are very small, and it is difficult to distinguish the colour variation. One way to change this is to experiment with the size of the points.
 
 
 
To do this, open the layer properties for <span><code>PoultrySuddenDeath_32750</code></span> and click on the ''Style'' tab again. This time, click on the change button next to ''Symbol''. Experiment with the size of the point until you think it is large enough to show the varying shades.
 
 
 
This is what it looks like when the size is set to 5 millimetres:
 
 
 
<span>[[Image:023.png|image]]</span>
 
 
 
=== What’s next? ===
 
 
 
This improves our map for showing which villages have recorded the most cases, but it would be better if we could show this using the village boundaries.
 
 
 
In our next lesson, we will learn how to join layers together by their location. This will enable us to create a new file that combines attributes such as the case numbers from the <span><code>PoultrySuddenDeath_32750</code></span> shapefile and the village boundaries from the <span><code>VillagePolyBarSin_32750</code></span> shapefile.
 
 
 
== Lesson: Joining two layers together ==
 
 
 
[animal<sub>h</sub>ealth/exercise5::doc] There are two ways we can join layers together:
 
 
 
* we can use the ''Join by location'' tool to create a new layer combining the attributes from two different layers, or,
 
* we can join using a single matching attribute.
 
 
 
'''The goal for this lesson:'''
 
 
 
To use create a new shapefile using the ''Join by location'' tool
 
 
 
To display information from a non-spatial file on a spatial file, by joining the two using a common data field.
 
 
 
=== [[Image:moderate.png|image]] Follow along: Join attributes by location ===
 
 
 
In the last lesson we reviewed how to use colour to show the density of case records in each village however the results were not really adequate because our file containing the case records shows them on the map as point data. We would really like to colour the entire villages as shown in the file containing the village boundaries. We can’t do this using the file as it is, because it does not contain the cases information. We need to join the two files using the ''Join attributes by location'' tool, located under ''Data Management Tools'' in the ''Vector'' menu.
 
 
 
<span>[[Image:024.png|image]]</span>
 
 
 
Use the <span><code>VillagePolyBarSin_32750</code></span> file as the Target vector layer, and the <span><code>PoultryMortality_32750</code></span> file as the Join vector layer:
 
 
 
* Click on ''Take the summary of the first located feature'' under ''Attribute Summary''
 
* Tick the ''Sum'' box underneath.
 
 
 
Browse to where you are going to save your file, and name it appropriately (we used <span><code>PoultryMJoinLocation_32750</code></span>).
 
 
 
Only keep the matching records. Click ''OK'' and add the new layer to your map.
 
 
 
Close the ''Join attributes by location'' dialog box.
 
 
 
Your results should look similar to this:
 
 
 
<span>[[Image:025.png|image]]</span>
 
 
 
Now open the ''Attribute table'' of your new layer. You can see that the new layer has the attributes of each original file, including the number of cases. We can now use this to improve our depiction of case density on the map.
 
 
 
=== [[Image:basic.png|image]] Try yourself... Style the villages to show the density of recorded cases ===
 
 
 
Using the skills from the previous lesson, amend the style to show the case density in each village. Experiment with the effect of choosing different intervals:
 
 
 
* '''Equal Interval:''' Divides your data into equally-spaced groups.
 
* '''Quantile:''' Uses an equation to divide values into equal-sized subsets.
 
* '''Natural breaks (Jenks):''' Tries to minimise differences within classes whilst maximising the difference between classes. Standard deviation: Illustrates how values deviate from the average.
 
* '''Pretty breaks:''' Breaks the values into classes that are easily understood by non-statisticians.
 
 
 
Explore the effect of each of these, using ''Apply'' to see the changes each makes to your map.
 
 
 
== Lesson: Joining vectors by attribute ==
 
 
 
For this exercise, we would like to join a file from the iSIKHNAS database, with no associated spatial data, with a shapefile that does have geometric data. By doing this, we can display the data from the iSIKHNAS file on a map of Indonesia.
 
 
 
'''The goal for this lesson:'''
 
 
 
Your supervisor would like the data in a report from iSIKHNAS displayed on a map of Indonesia.
 
 
 
The problem you face is there isn’t any spatial data associated with the data file.
 
 
 
To display the data for your supervisor, you are going to have to join the data file to a file that contains spatial data (such as a shapefile) and can be displayed.
 
 
 
=== [[Image:basic.png|image]] Follow along: Load the required files ===
 
 
 
Load the particular shapefile you wish to use. This could be:
 
 
 
<span><code>Provinces</code></span>
 
 
 
<span><code>Districts</code></span>
 
 
 
<span><code>Sub-districts</code></span>
 
 
 
In this example we are using the <span><code>Provinces</code></span> shapefile.
 
 
 
There are two ways in which we can load our table from iSIKHNAS. You already know the first one – loading layers using the ''Add vector layer button''.
 
 
 
<span>[[Image:025a.png|image]]</span>
 
 
 
In this scenario, you might download the data file you need as a .csv file from the iSIKHNAS website.
 
 
 
Save the .csv file in a folder where you will find it again.
 
 
 
Upload it to QGIS using the ''Add vector layer'' option.
 
 
 
Remember to choose the correct file type (in this case .csv). Otherwise it may default to shapefiles, and you will not be able to choose your .csv file.
 
 
 
<span>[[Image:025b.png|image]]</span>
 
 
 
Or, you might want to load your own Excel file that you have been working with. From QGIS 1.8 onwards, you are able to load an ''Excel'' file directly into QGIS as well.
 
 
 
<span>note</span><span>Note:</span> QGIS 1.8 will import Excel files saved as .xls, NOT in the newer .xlsx format.
 
 
 
If you are using QGIS 2.0 onwards, it should be able to import an .xlsx file.
 
 
 
The second way is using the supplied user login details to connect directly with the database.
 
 
 
<span>[[Image:025c.png|image]]</span>
 
 
 
In this example we have used the <span><code>rph_prov_week_gis_centroid</code></span> table, from the iSIKHNAS training database.
 
 
 
We have found this by scrolling through the available tables.
 
 
 
<span>[[Image:025d.png|image]]</span>
 
 
 
Double-click on the table and it will load in QGIS.
 
 
 
Our example QGIS project now looks like this. Save this as a new project.
 
 
 
<span>[[Image:025e.png|image]]</span>
 
 
 
=== [[Image:basic.png|image]] Follow along: Compare the loaded files ===
 
 
 
Look closely at the Layers window, and the two files shown there.
 
 
 
What do you notice?
 
 
 
<span>[[Image:025f.png|image]]</span>
 
 
 
The layer for the provinces can be displayed in QGIS, and therefore must contain spatial data. We know this from the little polygon icon next to the file name, and the little tick box beside it.
 
 
 
The layer for the slaughter statistics does not contain spatial data. It is a table only and cannot be displayed. We know this from the little table icon next to the file name, and there is no tick box.
 
 
 
Now compare the attribute tables for <span><code>rph_prov_week_gis_centroid</code></span> and <span><code>Provinces</code></span>.
 
 
 
What do you notice?
 
 
 
<span>[[Image:025g.png|image]]</span>
 
 
 
<span>[[Image:025h.png|image]]</span>
 
 
 
Both files contain an identical field – ''code'' (this is the unique code for each location).
 
 
 
The ''code'' field is the field we can use to join these two layers together. By creating a join, we can display the attributes from the <span><code>rph_prov_week_gis_centroid</code></span> file with the images from the <span><code>Provinces</code></span> shapefile.
 
 
 
=== [[Image:moderate.png|image]] Follow along: Joining files ===
 
 
 
Right-click on the <span><code>Provinces</code></span> shapefile and open the layer ''Properties''. Click on the ''Join'' tab as shown below:
 
 
 
<span>[[Image:025i.png|image]]</span>
 
 
 
Click on the green plus sign, to open this window:
 
 
 
<span>[[Image:025j.png|image]]</span>
 
 
 
The ''join layer'' is the <span><code>rph_prov_week_gis_centroid</code></span> file.
 
 
 
The ''join field'' is the field in the <span><code>rph_prov_week_gis_centroid</code></span> file that we are going to use to join the two files. In this case, we are going to use the field ''code''. This is selected from the drop down list.
 
 
 
The ''target field'' is ''code'' again – this is the field in the <span><code>Provinces</code></span> file that has matching data to the ''code'' field in the <span><code>rph_prov_week_gis_centroid</code></span> file.
 
 
 
<span>[[Image:025k.png|image]]</span>
 
 
 
The names of these fields do not necessarily have to match, but the information contained in each field must refer to the same attribute.
 
 
 
For example, one file might use the name ''code'' and the other file might use the name ''location_code''. We can still join the two files as long as the data itself is identical.
 
 
 
In this case we are referring to the code given to each location.
 
 
 
Click OK.
 
 
 
Now open the attribute table for the <span><code>Provinces shapefile</code></span> again.
 
 
 
What can you see?
 
 
 
<span>[[Image:025l.png|image]]</span>
 
 
 
The attributes from the <span><code>rph_prov_week_gis_centroid:kbd:</code></span> file (''gid'', ''name'', and ''sum'') are now in the attribute table for the <span><code>Provinces</code></span> file. The
 
 
 
We can now use this to map the data from the <span><code>rph_prov_week_gis_centroid</code></span> file on the <span><code>Provinces</code></span> image.
 
 
 
=== [[Image:basic.png|image]] Try yourself... Format your new map using the styling tab ===
 
 
 
Using the skills you learnt earlier about style formatting, look for ways that will display your data in a way that is helpful.
 
 
 
For example, we can now format our map to show density, because we have the sum of the number of animals slaughtered in our new attribute table.
 
 
 
<span>[[Image:025m.png|image]]</span>
 
 
 
Our <span><code>rph_prov_week_gis_centroid</code></span> file contained summary slaughter statistics for each province.
 
 
 
By joining this file with the <span><code>Provinces</code></span> file, we are able to format the style to indicate the numbers of animals slaughtered in each province.
 
 
 
=== In conclusion ===
 
 
 
It is possible to display the information in a data file that does not contain spatial data by joining it to a file that does contain spatial data.
 
 
 
Both files must contain an identical data field in order to join the two files.
 
 
 
The headings of the two fields do not have to be the same – just the data contained in those fields.
 
 
 
=== What’s next? ===
 
 
 
In our next, and final, exercise, we will investigate some of the movements data (showing livestock moving from one place to another). Here we will work through a simple and practical exercise as another example of an actual task that you may be asked to complete.
 
 
 
== Lesson: Working with movements data ==
 
 
 
[animal<sub>h</sub>ealth/exercise6:ls-working-with-movements-data] iSIKHNAS contains many types of data. One of these is movements data, showing the movement of livestock from one place to another.
 
 
 
'''The goal for this lesson:'''
 
 
 
To create a map that clearly shows livestock movements.
 
 
 
Your supervisor would like you to extract a dataset of poultry movements between certain dates. S/he would then like you to create a map that shows:
 
 
 
* Poultry movements between 1 December 2013 and 31 December 2013
 
* Format the style to clearly show density
 
 
 
=== [[Image:moderate.png|image]] Follow along: Selecting data using SQL ===
 
 
 
For this exercise, start a new project. Load the following shapefiles supplied in your data folder:
 
 
 
* <span><code>Indonesia_32750</code></span>
 
* <span><code>Sulawesi_dist_32750</code></span>
 
* <span><code>movements_32750</code></span>
 
 
 
Use the ''Layer Properties'' to style the layers as necessary like you have done in the exercises.
 
 
 
Your new map should look similar to this:
 
 
 
<span>[[Image:026.png|image]]</span>
 
 
 
Open the ''Attribute table'' for the <span><code>Movements_32750</code></span> layer. You can do this by either right-clicking on the <span><code>Movements_32750</code></span> layer, and selecting ''Open Attribute Table'', or you can click on the icon in the menu bar as shown below:
 
 
 
<span>[[Image:027.png|image]]</span>
 
 
 
Here we will select the records we want using SQL. Open the ''Advanced search'' option. You want to select all records relating to poultry, that are between 1 December 2013 and 31 December 2013.
 
 
 
To do this, you need the following query:
 
 
 
(“Tanggal” &gt;= ‘2013-12-01’ AND “Tanggal” &lt;= ‘2013-12-31’) AND ((“Spesies” = ‘broiler’) OR (“Spesies” = ‘chicken’) OR (“Spesies” = ‘duck’) OR (“Spesies” = ‘pigeon’))
 
 
 
This query is asking to return records:
 
 
 
Between the two dates: (“Tanggal” &gt;= ‘2013-12-01’ AND “Tanggal” &lt;= ‘2013-12-31’)
 
 
 
AND
 
 
 
With the following species:
 
 
 
((“Spesies” = ‘broiler’) OR (“Spesies” = ‘chicken’) OR (“Spesies” = ‘duck’) OR (“Spesies” = ‘pigeon’))
 
 
 
If you test the query, it should return 30 records:
 
 
 
<span>[[Image:028.png|image]]</span>
 
 
 
Close the attribute table. Your selected records should be highlighted in yellow on your map.
 
 
 
Right-click on the <span><code>movements_32750</code></span> and choose the ''Save selection as'' option. Save your new layer with an appropriate name such as <span><code>movements_poultry_32750</code></span>. You can now remove the <span><code>movements_32750</code></span> layer.
 
 
 
When you look closely, you will see that all the movements take place in Sulawesi. If you like, you can remove the layer <span><code>Indonesia_32750</code></span>.
 
 
 
In the next section we will review styling again, and show density in our movement data.
 
 
 
=== [[Image:moderate.png|image]] Follow along: Style formatting ===
 
 
 
Our movements data for is now showing on the map, but it doesn’t really tell us too much about it. We can use styling to show more.
 
 
 
Right-click on your new <span><code>movements_poultry_32750</code></span> and click on the ''Style'' tab.
 
 
 
As you have learnt previously, here you can style your layer to show attributes such as density. You can also:
 
 
 
* colour the movement lines according to the number of animals in each movement (density)
 
* increase the width of the movement lines to show the number of animals in each movement
 
* layer the movement lines so thinner lines are displayed on top of the wider lines
 
 
 
=== [[Image:moderate.png|image]] Try yourself... Style formatting ===
 
 
 
Review Section 16.4.1 ''Styling to show density'' and Section 16.5.2 ''Style the villages to show the density of the recorded cases''.
 
 
 
Format the movement lines using colour to show the number of animals in each movement. The column you will use is ''Jumlah Hew''.
 
 
 
Once you have your individual lines, you can double-click on each one and a new window will open. Here you can edit your line for things such as width, colour, transparency:
 
 
 
<span>[[Image:029.png|image]]</span>
 
 
 
Experiment with the width of each line until you are happy with your results.
 
 
 
After changing the width of each graduated line, you will then be able to order the lines so the widest lines appear underneath the thinnest ones.
 
 
 
Still in the ''Layer properties'' window, click on ''Advanced'', and then ''Symbol levels'':
 
 
 
<span>[[Image:030.png|image]]</span>
 
 
 
This opens up a new window, where you can order your symbols:
 
 
 
<span>[[Image:031.png|image]]</span>
 
 
 
When ordering symbols, the first symbol to be placed on the map is the one with a zero. In the image above, you can see that our widest line is a zero, and the narrowest line is a four. The result is this:
 
 
 
<span>[[Image:032.png|image]]</span>
 
 
 
This shows our lines formatted using colour and line width to show the number of animals in each movement. The darker, thicker line shows us there were between 860 and 1000 birds moved in this particular movement.
 
 
 
=== What’s next? ===
 
 
 
Our final lesson is to show how to load another type of data into QGIS. Sometimes you will receive data as a spreadsheet, or you might download it from a source such as a database as a CSV file. We will now show you how to load this type of data into QGIS.
 
 
 
== Lesson: Loading point data ==
 
 
 
[animal<sub>h</sub>ealth/exercise7::doc] We have worked with data in the form of shapefiles, raster files, and directly from databases. Sometimes your data will be in an Excel spreadsheet, with longitude and latitude. It is important that you know how to load data when it is in this format.
 
 
 
'''The goal for this lesson:'''
 
 
 
To load and plot data from a spreadsheet.
 
 
 
=== [[Image:basic.png|image]] Follow along: Loading a Delimited Text File ===
 
 
 
For this exercise, you will begin a new project.
 
 
 
We have worked with data in the form of shapefiles, raster files, and directly from databases. Often you might receive data in the form of a spreadsheet, so it is important to know how to load this data into QGIS.
 
 
 
Data is supplied in this way is often in a CSV file, which is a delimited text file. To load these types of files, we will use the “Add Delimited Text Layer” plugin:
 
 
 
<span>[[Image:033.png|image]]</span>
 
 
 
Click on this button, and the following dialog will open:
 
 
 
<blockquote><span>[[Image:034.png|image]]</span>
 
</blockquote>
 
Browse to the course exercise data, and load <span><code>PointData.csv</code></span> from the folder ''ISIKHNAS''. This is just randomly generated point data to use for this exercise.
 
 
 
The plugin does a very good job of reviewing the information contained in the file, but you will need to give it some guidance. In this file, the delimiter is a comma, so we need to select “Comma” as the delimiter.
 
 
 
Your dialog box now looks like this:
 
 
 
<span>[[Image:035.png|image]]</span>
 
 
 
Click on the <span><code>OK</code></span> button. You will now be asked to specify the CRS. This should make you think about what format the data was collected in. For now we will select WGS 84 EPSG:4326. Click <span><code>OK</code></span>.
 
 
 
You should have a layer similar to the following image:
 
 
 
<span>[[Image:036.png|image]]</span>
 
 
 
This shape should look familiar - load the shapefile <span><code>Sul_sthn_dist</code></span>, and rearrange the layers so the point data is the top layer.
 
 
 
You should now see something like this:
 
 
 
<span>[[Image:037.png|image]]</span>
 
 
 
=== In conclusion ===
 
 
 
This chapter has been designed to show you how to use QGIS in a practical and useful way, using real data obtained from the iSIKHNAS database. The exercises have been developed to show examples of actual tasks you may be asked to carry out by your supervisor.
 
 
 
It is only a small example of what you can do using the QGIS software. If you are interested, do not be afraid to explore the software. Use the internet to search for new ways to create particular maps, or investigate different ways of doing things.
 
 
 
= Answer Sheet =
 
 
 
[answers/answers::doc]
 
 
 
== Results for ''Adding Your First Layer'' ==
 
 
 
=== [[Image:basic1.png|image]] ''Preparation'' ===
 
 
 
[answers/answers:basic-preparation] You should see a lot of lines, symbolizing roads. All these lines are in the vector layer that you just loaded to create a basic map.
 
 
 
== Results for ''An Overview of the Interface'' ==
 
 
 
=== [[Image:basic1.png|image]] ''Overview'' (Part 1) ===
 
 
 
[answers/answers:basic-overview-part-1] Refer back to the image showing the interface layout and check that you remember the names and functions of the screen elements.
 
 
 
=== [[Image:basic1.png|image]] ''Overview'' (Part 2) ===
 
 
 
[answers/answers:interface-overview-2]
 
 
 
# ''Save as''
 
# ''Zoom to layer''
 
# ''Help''
 
# ''Rendering on/off''
 
# ''Measure line''
 
 
 
== Results for ''Working with Vector Data'' ==
 
 
 
=== [[Image:basic1.png|image]] ''Shapefiles'' ===
 
 
 
[answers/answers:basic-shapefiles] There should be three layers on your map:
 
 
 
* ''waterways''
 
* ''places'' and
 
* ''streets''.
 
 
 
=== [[Image:basic1.png|image]] ''Databases'' ===
 
 
 
[answers/answers:vector-load-from-database-1] All the vector layers should be loaded into the map. It probably won’t look nice yet:
 
 
 
<span>[[Image:0011.png|image]]</span>
 
 
 
(We’ll fix the ugly colors later.)
 
 
 
== Results for ''Symbology'' ==
 
 
 
=== [[Image:basic1.png|image]] ''Colors'' ===
 
 
 
[answers/answers:symbology-colors-1]
 
 
 
* Verify that the colors are changing as you expect them to change.
 
* It is enough to change only the ''waterways'' layer for now. An example is below, but may look different depending on the color you chose.
 
 
 
<span>[[Image:0181.png|image]]</span>
 
 
 
<span>note</span><span>Note:</span> If you want to work on only one layer at a time and don’t want the other layers to distract you, you can hide a layer by clicking in the check box next to its name in the Layers list. If the box is blank, then the layer is hidden. We have hidden some of the layers in this picture.
 
 
 
=== [[Image:basic1.png|image]] ''Symbol Structure'' ===
 
 
 
[answers/answers:basic-symbol-structure] Seen together, your forests, waterways, and bandung_districts layers should look more or less like this:
 
 
 
<span>[[Image:0201.png|image]]</span>
 
 
 
If you are a Beginner-level user, you may stop here.
 
 
 
* Use the method above to change the colors and styles for all the remaining layers.
 
* Try using natural colors for the objects. For example, a road should not be red or blue, but can be gray or black.
 
* Also feel free to experiment with different ''Fill Style'' and ''Border Style'' settings for the polygons.
 
 
 
=== [[Image:moderate1.png|image]] ''Symbol Layers'' ===
 
 
 
[answers/answers:moderate-symbol-layers]
 
 
 
* Customize your layers as you like, but remember that it has to be easy to tell different layers apart on the map.
 
 
 
Here’s an example:
 
 
 
<span>[[Image:0131.png|image]]</span>
 
 
 
=== [[Image:moderate1.png|image]] ''Symbol Levels'' ===
 
 
 
[answers/answers:moderate-symbol-levels] To make the required symbol, you need at least three symbol layers:
 
 
 
<span>[[Image:0211.png|image]]</span>
 
 
 
The lowest symbol layer is a broad, solid yellow line. On top of it there is a slightly thinner solid dark gray or black line. The symbol layer on top is a thin white dashed line.
 
 
 
<ul>
 
<li><p>If your symbol layers resemble the above but you’re not getting the result you want, check that your symbol levels look something like this:</p>
 
<p><span>[[Image:0221.png|image]]</span></p></li>
 
<li><p>Now your symbol should look like this:</p>
 
<p><span>[[Image:0231.png|image]]</span></p></li>
 
<li><p>Which, on the map, gives you this kind of effect:</p>
 
<p><span>[[Image:0241.png|image]]</span></p></li></ul>
 
 
 
=== [[Image:hard1.png|image]] ''Symbol Levels'' ===
 
 
 
[answers/answers:hard-symbol-levels]
 
 
 
* Adjust your symbol levels to these values:
 
 
 
<span>[[Image:0261.png|image]]</span>
 
 
 
* There are a lot of symbols with this style
 
* Experiment with different values to get different results.
 
* Open your original map again before continuing with the next exercise.
 
 
 
== Results for ''Attribute Data'' ==
 
 
 
=== [[Image:basic1.png|image]] ''Attribute Data'' ===
 
 
 
[answers/answers:labels-attribute-data-1] The ''NAME'' field is the most useful to show as labels. This is because all its values are unique for every object, and it contains no “null” values (i.e., fields with no value).
 
 
 
== Results for ''The Label Tool'' ==
 
 
 
=== [[Image:moderate1.png|image]] ''Label Customization'' (Part 1) ===
 
 
 
[answers/answers:label-tool-1] Your map should look like this:
 
 
 
<span>[[Image:0101.png|image]]</span>
 
 
 
=== [[Image:moderate1.png|image]] ''Label Customization'' (Part 2) ===
 
 
 
[answers/answers:moderate-label-customization-part-2] One possible solution has this final product:
 
 
 
<span>[[Image:0151.png|image]]</span>
 
 
 
To arrive at this result:
 
 
 
<ul>
 
<li><p>Use the font type <span><code>Arial</code></span> of size <span><code>10</code></span> and a ''Label distance'' of <span><code>1,5 mm</code></span>.</p></li>
 
<li><p>In addition, this example uses the ''Wrap label on character'' option:</p>
 
<p><span>[[Image:0161.png|image]]</span></p></li>
 
<li><p>Enter a <span><code>space</code></span> in this field and click ''Apply'' to achieve the same effect.</p></li></ul>
 
 
 
=== [[Image:hard1.png|image]] ''Using Data Defined Settings'' ===
 
 
 
[answers/answers:hard-using-data-defined-settings]
 
 
 
<ul>
 
<li><p>Still in edit mode, set the <span><code>FONT_SIZE</code></span> values to whatever you prefer. The example uses <span><code>14</code></span> for universities, <span><code>12</code></span> for hospitals, and <span><code>10</code></span> for the remaining places.</p></li>
 
<li><p>Remember to save changes and exit edit mode.</p></li>
 
<li><p>In ''Data defined settings'', do this:</p>
 
<p><span>[[Image:0262.png|image]]</span></p>
 
<p>Your results, if using the above values, should be this:</p>
 
<p><span>[[Image:0271.png|image]]</span></p></li></ul>
 
 
 
== Results for ''Classification'' ==
 
 
 
=== [[Image:moderate1.png|image]] ''Refine the Classification'' ===
 
 
 
[answers/answers:classification-refine-1]
 
 
 
<ul>
 
<li><p>Use the same method as in the first exercise of the lesson to get rid of the lines:</p>
 
<p><span>[[Image:0272.png|image]]</span></p></li></ul>
 
 
 
The settings you used might not be the same, but with the values ''Classes'' = <span><code>7</code></span> and ''Mode'' = ''Natural Breaks (Jenks)'' (and using the same colors, of course), the map will look like this:
 
 
 
<span>[[Image:0281.png|image]]</span>
 
 
 
[answers/answers:backlink-create-vector-digitize-1]
 
 
 
== Results for ''Vector Analysis'' ==
 
 
 
=== [[Image:basic1.png|image]] ''Find Important Roads'' ===
 
 
 
[answers/answers:vector-analysis-basic-1] Your layer should now have these roads:
 
 
 
<span>[[Image:0171.png|image]]</span>
 
 
 
* Save this new layer (the same way you did before) under <span><code>exercise_data/residential_development/</code></span>, as <span><code>important_roads.shp</code></span>.
 
* Once the new layer has been added to your map, remove the old layer.
 
* If for some reason it gives you an error message saying that it can’t add the layer to the map (this can happen), remember that you can add the layer yourself by using the ''Add Vector Layer'' button as you did before.
 
 
 
=== [[Image:basic1.png|image]] ''Distance from High Schools'' ===
 
 
 
[answers/answers:vector-analysis-basic-2]
 
 
 
<ul>
 
<li><p>Your buffer dialog should look like this:</p>
 
<p><span>[[Image:0242.png|image]]</span></p></li></ul>
 
 
 
The ''Buffer distance'' is <span><code>10000</code></span> meters (i.e., <span><code>10</code></span> kilometers).
 
 
 
* The ''Segments to approximate'' value is set to <span><code>20</code></span>. This is optional, but it’s recommended, because it makes the output buffers look smoother.
 
 
 
Compare this:
 
 
 
<span>[[Image:0251.png|image]]</span>
 
 
 
To this:
 
 
 
<span>[[Image:0263.png|image]]</span>
 
 
 
The red circle is the buffer with ''Segments to approximate'' set to <span><code>20</code></span>; the gray circle on top of it is the buffer with ''Segments to approximate'' set to <span><code>5</code></span>.
 
 
 
= Indices and tables =
 
 
 
* ''genindex''
 
* ''modindex''
 
* ''search''
 
 
 
<references />
 

Revisi terkini pada 24 Oktober 2014 15.38