| FFS – Land degradation assessment Training module Lesson 3 Thomas Gumbricht ICRAF |
Using Farmer Field Schools Approaches to Overcome Land Degradation in Agro-Pastoral Areas of Kenya
Land degradation assessment – Baseline survey on spatial analysis of land cover / degradation trends and Toolkit Development.
Training module created by Thomas Gumbricht, www.mapjourney.com
Last updated: October 2007
LESSON 2 – SELECTING FEATURES, LABELING AND DESIGNING MAPS
Lesson overview
In this lesson you will learn how to select features in a layer and create a new vector layer from the selection; and how to label and design maps using DIVA-GIS.
Create new project and set options
Open new project
Start DIVA-GIS and open a new project by clicking the New Project button,
, or via the menu: Project - New. Save the new project, e.g. calling it lesson3.
Set DIVA-GIS defaults and options
In this lesson you will work with the database and create some new data layers and image files. In DIVA-GIS you can set different options for how to select data in the Data View. To get to the various options go via the menu: Tools – Options. Skip the Climate tab, and click the Layer tab.
In this lesson you are going to create new layers and design maps, and export them as files. Hence if you are working using a CD you must uncheck the option for Save relative paths in the project file, otherwise keep it checked. Also if you work with the dataset on a CD you must create a project folder on your local hard drive for saving the files you generate in this lesson. There are also other options to set, but you can leave them for now. Once you are into this lesson you might want to return to the Options menu and make some changes in your settings.
Select - Query
Use the Add Layer tool,
, or go via the menu: Layer – Add Layer, navigate to the folder \data_spatial\ke\mapdata\politic and add the layer ke_Kenya_districts.shp. Open the Properties window for this layer, either by double clicking the layer in the Legend, via the menu: Layer – Properties, or click the Properties tool,
. To start with you only need to symbolize the districts using a Unique value, so make sure the Unique tab is selected, as shown below (left). Double click the rectangular symbol icon to open the Symbol window. And set the Style to Solid Fill. Then also select a Color and a Border Color. If you need to repeat symbolization, you can go back to
lesson 2.
You should now have a DIVA-GIS project window that shows the districts of Kenya. In the example below the Label was changed (in the Properties window).
The project to which this lesson belongs used three districts in Kenya for more detailed studies, Mbeere, Mwingi and Narok. To locate these districts, you need to select these districts by a Query – that is ask the database to find the districts for you. Query or selection is a very important function in GIS, and one of the key differences between a GIS and an ordinary map. Open the Select (Query) window in DIVA-GIS by clicking the Query tool,
, or via the menu: Layer – Select Records.
Make sure the tab for Select by values is on top, click the drop down menu for Variable and select DISTRICT. You will get a list with all districts of Kenya. You have to use the scroll bar to the right to see them all. Click the Clear All button,
, and scroll down and check the records for Mbeere, Mwingi and Narok (you can also choose just one or two of them).
Click the Apply button,
, and close the Select window. Your Data View should now show the districts that you selected, in the color that was set in the Option window at the beginning of this lesson (you can now change the option for Color of selected features if you want, but the tutorial will use yellow).
When you selected the features, the Zoom to Selected tool,
, became active. If you click on it, the Data View will zoom to show the selected features. In the example below, an overview map was added, simply by clicking F7 (see
lesson 1 to repeat how to make an overview map). To remove the overview map, simply press F7 again.
To clear the selection, click the Clear Selection tool,
, or go via the menu: Layer – Clear Selection.
You can also select features directly from the Data View, with the Select Feature tool,
,or via the menu: Layer – Select Feature. The Select Feature will appear pressed down,
, and the cursor changes to a crosshair. If you click on a feature it will become selected and turn yellow.
To select more than one feature, for adjacent features (like Mbeere and Mwingi) you can use the mouse to draw a rectangle (or circle or polygon – you can set this in the Option window – see above in this lesson), and all features falling inside the rectangle will be selected. To select features that are not adjacent, you first select one, then hold down the Ctrl + Shift keys and click (or draw a rectangle/polygon etc) around the features you want to add to the selection (this function is a bit unstable in DIVA-GIS, but you can try).
Save as new shapefile
Select the district(s) you want to work with. In DIVA-GIS you now have the option to create a new shape file containing only the selected features. Click the Convert To Shapefile tool,
, or go via the menu: Data – Selection to New Shapefile. In the Save As window that pops up navigate to your my diva directory, give the new layer a logical name and save it as a shapefile (*.shp).
The new shape layer will be automatically added to the DIVA-GIS Data View. It will be symbolized as a polygon with no fill and a black border (DIVA-GIS default).
Symbolizing nominal data
In the attribute table for districts in Kenya we only have nominal (i.e. name) data. In lesson 2 you learnt that nominal data can be symbolized using either a single value (one color for all features), or using Unique values. Make the old district map the active theme, and open the Properties window. Select the tab for Unique, set the Field for symbolization to DISTRICT in the drop down menu. Click the Reset Legend button. All districts will get a default color, which is unique for each district. You can change the color for each feature by clicking the small symbol icon (rectangle for polygon themes).
You can also exclude any feature by unchecking the checkbox for that feature in the Properties window. First just look at the alternative of having all districts included, with Unique values for the Symbolization. Click Apply and you should get a Data View similar to the one below.
The symbolization is very difficult to read, there are too many entries, and you can hardly identify the districts from the legend. One alternative is to return to a single symbolization for all the districts, and then symbolize the layer with the selected districts separately and put the selected districts on top. Try that out, and you should get a map similar to the one below (with your choice of colors).
Labeling
A second, and perhaps better alternative, to symbolization is to put labels directly in the map. Make the theme with all districts in Kenya the active theme, and go via the menu: Layer – Add Labels.
In the Add Labels window select the Field DISTRICT for labeling in the drop down menu, you can choose if the label should have a colored background, and what color that background should have.
Click the Set font button,
, in the Add Labels menu to select font and the font style etc.
Click OK in the Font window, and OK in the Add Labels window, and your map will get labels. The name of each district is now easy to see and read.
If you, however turn on the layer with selected districts, the labeling will disappear under these districts. Try to symbolize the old district map using Unique values (check the Use color of single tab before clicking Reset legend) in the Properties window, as shown below.
When you click Apply the symbolization of the polygons work fine, but the labeling will disappear, as shown below.
If you put labels on a map symbolized with Unique values, the uniqueness will disappear. This is a small bug in DIVA-GIS, but there is a way to get around. You simply add a second copy of the layer ke_Kenya-districts, which you can do by just copying a layer in the Legend and then paste it from the menu: Data – Copy Layer / Paste Layer. Put the second copy of the layer on top in the Legend, and use this copy of the district layer for labeling. The labels will then end up on top of the map, and the symbolization of the underlying layers can be done without consideration of labeling. In the example below the legend of the labeling theme (ke_Kenya_district) was hidden. You can hide the legends from the menu: Layer – Hide/Show Legend, or by pointing at the layer in the legend and clicking the right mouse button and selecting Hide/Show Legend.
Designing a map
When you are satisfied with the district map of Kenya, click the Design tab in the lower right corner of the Project window. An empty Design View will open. The tools at the top of the Design View are used for adding map elements to the Design view. Most are gray, to get them active you must start by adding the Data View. Click the Symbol for Add Map,
, unless it is not already chosen (activated by default when a new design is created). You can decide where in the Design View you want to have the map (or rather, its upper left corner), by entering Location X and Y values followed by clicking the OK button,
. You can also tell DIVA-GIS to Cut white space (areas in the Data View where that are not covered by a layer).
With the map element in the design view you can just click in the Design View to add other Map elements, or another instance of the Data View. The editing capacity of the Design View is not very developed, and once a map component has been added you can not move it, but either click the Undo button,
, before you add another component, or simply start all over again by clicking the Clear all tool,
. When you added the map to the Design View, the other tool buttons for adding map components became active (colored). Add the legend by clicking the Legend button,
. Clicking any of the tools for adding a map components changes the menu to the left to reflect properties you can set for that particular map component. With the map element added, there is a better to position forthcoming elements: by clicking directly in the Design View. The element will then be positioned with its upper left corner at the click-point. When adding the Legend element below, the legend entry for the copy of ke_Kenya_districts, used for labeling the map, was unchecked, and it is not shown in the Design View.
Then add a scale element by clicking the Scale tool,
. The scale bar options appear in the menu to the left, with distance units set to the Distance Measurement Units set for your project (see
lesson 1).
Add a North Arrow by clicking the North Arrow button,
. You can also include an overview map, by clicking the Overview Map button,
, but in the map we are now designing the Map component and the Overview map are then same, sono overview map is needed. Finally you can add text to your design by clicking the Text button,
. For the text component you can set the font and its characteristics by clicking the Font tool,
.
The next time you add a map component to the Design View, it will get the font that you have set. In this way you can use different fonts for your different components (including different text entries). By choosing a color from the Color tool,
, you can set the color also of the Scale ba,r the North Arrow, and outlines around the Legend and Overview Map components. The Color tool overrides any setting of font colors, and can be used to select a wider variety of font colors also for Text components.
When you have finished designing your map you can export it to the windows clipboard, print it, or create an image by clicking one of the Export tools,
. The image below was simply created by clicking the Copy to Clipboard button, then clicking in the word document used for making this lesson and pressing ctrl-v.
Below is another map that was done using the Design View in DIVA-GIS. First one district maps was zoomed to in the Data View (with a small View window), then the pan function was used to the other in order to preserve the scale. And a second instance of the Data View (Map component) was added to the Design View. Then the scale bar was added to reflect the scale of the selected districts in their zoomed state. The Overview Map and the Text were added (using different font sizes and colors etc), and finally the North Arrow was added.