Add another layer of data to learn the selection controls. Browse to workshop_data/part_one folder and add egypt_adm0_iso-8859-1.shp
Another way to view all the attributes for the features in a given layer, is to right-click on the LAYER in the LAYER LIST, then select OPEN ATTRIBUTE TABLE from the drop-down choices. Browse the Attribute Table and notice the top row contains FIELD names, and each row contains the values for those field types for a particular features. One ROW = one spatial feature in the chosen layer.
Select a single feature by clicking on the ROW NUMBER at the left side of the Attribute Table. The SELECTED ROW will be highlighted. Move your cursor over the SELECTION OPTIONS along the top of the Attribute Table. Tooltips will appear indicating various options, such as TOGGLE EDITS, SAVE EDITS, etc. Click on ZOOM TO SELECTION, and the MAP VIEW extent will zoom in to show the selected item (or multiple selected items).
Convenient selections options for working with attributes are: UNSELECT, MOVE SELECTED ROWS TO TOP, INVERT SELECTION, SELECT BY EXPRESSION or SQL QUERY, and ZOOM TO SELECTION.
The TOGGLE EDIT button turns the editing mode on or off. This will also be reflected in the Map View, where vector features that can be edited will be highlighted. If the the number of features (and their vertices) is large, the Map View may take a moment to refresh.
When the EDIT MODE is ON, additional functions will be enabled in the attribute table options, for example: DELETE SELECTION, COPY SELECTION, DELETE COLUMN, INSERT NEW COLUMN, OPEN FIELD CALCULATOR. These options will be discussed in the EDIT section of this tutorial.
Click the EDIT TOGGLE button again, to exit the editing mode, and then DISCARD CHANGES. Right-click on a layer in the LAYER LIST, then select ZOOM TO LAYER EXTENT in order to see all the features of that layer in the MAP VIEW.
The MAP VIEW should now be zoomed out to the extent at which all the features in the chosen layer are visible.
Now we will use the Main Menu to unselect the highlighted features. On the top menu click on VIEW, then move the mouse cursor down to SELECT, over to the right to in order to scroll down to the last item: DESELECT FEATURES FROM ALL LAYERS. Clicking on the command DESELECT FROM ALL LAYERS will remove the selection status in both the attribute table and the MAP VIEW.
Add another vector layer to your project, this time add egypt_gns_pts_utf-8.shp using UTF-8 encoding.
Now there will be three layers in the LAYER LIST. Notice that the each new layer appears on top of the other layers in the list, so that the Points are on top of the polygons.
Let's change the layer order, by clicking and dragging the bottom layer to the top of the stack in the LAYER LIST and letting go.
The top layer should now be shown "on top" of the MAP VIEW. Basically, the LAYER LIST order controls the drawing order for the layers, with the top-most layer in the LAYER LIST drawn last ON TOP of the others. By selecting the drawing order, transparency and symbolization, you can control exactly what you want to see on your map view.
Another way to control the layers shown in the MAP VIEW is to UNCHECK them in the LAYER LIST. FY FEATURES BY RECTANGLE TOOL, and try dragging a box to select features. Because the TOP LAYER is the ACTIVE LAYER and is UNCHECKED you will see that NO features are selected.
By default in QGIS, the IDENTIFY or SELECTION tools will return features from only the ACTIVE layer in the LAYER LIST. Now make the bottom layer ACTIVE by clicking on it (egypt_adm1). Drag a box over some features in the MAP VIEW. You will see that ONLY the features in the ACTIVE LAYER were selected and highlighted in yellow. Even though the points layer (egpyt_gns) is ON TOP of the the layer being selected from, the points layer is not the ACTIVE LAYER, so no point features were selected!
Right-click on the ACTIVE LAYER and OPEN THE ATTRIBUTE TABLE. Click on the MOVE UP tool to see the highlighted rows that appeared on the map. Now you can see how the spatial selection in the map view can be used to discover all the attributes stored in the table. NOTE: the top line of the Attribute Table will always explicitly state the total number of features in the table, and how many rows are CURRENTLY SELECTED. In this example, there are 26 features total in the egypt_adm1 layer, and our spatial selection found 4 features.
Click the DESELECT FEATURES FROM ALL LAYERS tool.
Now click on the points layer (egpyt_gns) in the LAYER LIST to make it active. Click on the SELECT BY RECTANGLE TOOL AGAIN, and drag a small box across the map view to select some piont features. Note that in the map view ONLY the active layer point features were highlighted.
Now right-click on the points layer (egpyt_gns) in the LAYER LIST and OPEN ATTRIBUTE TABLE. Drag the horizontal scroolbar at the bottom of the table until you can see the placename columns. Note that our UTF-8 dataset is showing the Arabic placenames perfectly, one of the great aspects of QGIS! Reading the table details, we can see that in our example, we have selected 153 point features out of 20,004 total features in the points layer.
By default the Attribute Table is set to SHOW ALL FEATURES. This can toggled to other settings on the lower left side of the table. Click on the SHOW ALL ATTRIBUTES drop-down menu and then click SHOW SELECTED FEATURES. Now if you scroll down the table, you will only have 153 visible rows (rather than 20004) rows.
Proceed to QUERY BUILDER tutorial.
|