4. Vektorattributdaten

gentleLogo

Ziele:

In this topic we describe how attribute data are associated with vector features and can be used to symbolise data.

Schlüsselwörter:

Attribut, Datenbank, Felder, Daten, Vektor, Symbologie

4.1. Übersicht

If every line on a map was the same colour, width, thickness, and had the same label, it would be very hard to make out what was going on. The map would also give us very little information. Take a look at Abb. 4.6 for example.

../../_images/map_attributes.png

Abb. 4.6 Maps come to life when colour and different symbols are used to help you to tell one type of feature from the next. Can you tell the difference between rivers, roads and contours using the map on the left? Using the map on the right it is much easier to see the different features.

In this topic we will look at how attribute data can help us to make interesting and informative maps. In the previous topic on vector data, we briefly explained that attribute data are used to describe vector features. Take a look at the house pictures in Abb. 4.7.

../../_images/house_picture.png

Abb. 4.7 Every feature has characteristics that we can describe. These can be visible things, or things we know about the feature (e.g. year built).

The geometry of these house features is a polygon (based on the floor plan of the house), the attributes we have recorded are roof colour, whether there is a balcony, and the year the house was built. Note that attributes don’t have to be visible things –– they can describe things we know about the feature such as the year it was built. In a GIS Application, we can represent this feature type in a houses polygon layer, and the attributes in an attribute table (see Abb. 4.8).

../../_images/houses_in_gis.png

Abb. 4.8 A houses layer. House features have attributes that describe the houses’ roof colour and other properties. The attribute table (lower image) lists the attributes for the house areas shown on the map. When a feature is highlighted in the table, it will appear as a yellow polygon on the map.

The fact that features have attributes as well geometry in a GIS Application opens up many possibilities. For example we can use the attribute values to tell the GIS what colours and style to use when drawing features (see Abb. 4.9). The process of setting colours and drawing styles is often referred to as setting feature symbology.

../../_images/style_by_attribute.png

Abb. 4.9 In a GIS Application, we can draw features differently depending on their attributes. On the left we have drawn house polygons with the same colour as the roof attribute. On the right we colour coded houses according to whether they have a balcony or not.

Attribute data can also be useful when creating map labels. Most GIS Applications will have a facility to select an attribute that should be used to label each feature.

If you have ever searched a map for a place name or a specific feature, you will know how time consuming it can be. Having attribute data can make searching for a specific feature quick and easy. In Abb. 4.10 you can see an example of an attribute search in a GIS.

../../_images/search_by_attribute.png

Abb. 4.10 In a GIS Application, we can also search for features based on their attributes. Here we see a search for houses with black roofs. Results are shown in yellow in the map, turquoise on the table.

Finally, attribute data can be very useful in carrying out spatial analysis. Spatial analysis combines the spatial information stored in the geometry of features with their attribute information. This allows us to study features and how they relate to each other. There are many types of spatial analysis that can be carried out, for example, you could use GIS to find out how many red roofed houses occur in a particular area. If you have tree features, you could use GIS to try to find out which species might be affected if a piece of land is developed. We can use the attributes stored for water samples along a river course to understand where pollution is entering into the stream. The possibilities are endless! In a later topic we will be exploring spatial analysis in more detail.

Before we move on to attribute data in more detail, let’s take a quick recap.

Features are real world things such as roads, property boundaries, electrical substation sites and so on. A feature has a geometry (which determines if it is a point, polyline or polygon) and attributes (which describe the feature). This is shown in Abb. 4.11.

../../_images/feature_at_glance.png

Abb. 4.11 Vector features at a glance.

4.2. Attributes in detail

Attributes for a vector feature are stored in a table. A table is like a spreadsheet. Each column in the table is called a field. Each row in the table is a record. Table table_house_attributes shows a simple example of how an attribute table looks in a GIS. The records in the attribute table in a GIS each correspond to one feature. Usually the information in the attribute table is stored in some kind of database. The GIS application links the attribute records with the feature geometry so that you can find records in the table by selecting features on the map, and find features on the map by selecting features in the table.

Attributtabelle

Field 1 : YearBuilt

Field 2: RoofColour

Field 3: Balcony

Record 1

1998

Red

Yes

Record 2

2000

Black

No

Record 3

2001

Silver

Yes

Table House Attributes: An attribute table has fields (columns) and records (in rows).

Each field in the attribute table contains a specific type of data –– text, numeric or date. Deciding what attributes to use for a feature requires some thought and planning. In our house example earlier on in this topic, we chose roof colour, presence of a balcony and month of construction as attributes of interest. We could just as easily have chosen other aspects of a house such as:

  • number of levels

  • number of rooms

  • number of occupants

  • type of dwelling (RDP House, block of flats, shack, brick house, etc)

  • year the house was built

  • area of floor space in the house

  • and so on….

With so many options, how do we make a good choice as to what attributes are needed for a feature? It usually boils down to what you plan to do with the data. If you want to produce a colour coded map showing houses by age, it will make sense to have a ‚Year Built‘ attribute for your feature. If you know for sure you will never use this type of map, it is better to not store the information. Collecting and storing unneeded information is a bad idea because of the cost and time required to research and capture the information. Very often we obtain vector data from companies, friends or the government. In these cases it is usually not possible to request specific attributes and we have to make do with what we get.

4.3. Einfache Symbole

Wenn ein Merkmal ohne Verwendung von Attributtabellendaten symbolisiert wird, kann es nur auf einfache Weise gezeichnet werden. Bei Punktmerkmalen können Sie z. B. die Farbe und die Markierung (Kreis, Quadrat, Stern usw.) festlegen, aber das ist auch schon alles. Sie können dem GIS nicht sagen, dass es die Merkmale auf der Grundlage einer ihrer Eigenschaften in der Attributtabelle zeichnen soll. Um dies zu tun, müssen Sie entweder ein graduiertes, kontinuierliches oder eindeutiges Wertesymbol verwenden. Diese werden in den folgenden Abschnitten im Detail beschrieben.

In einer GIS-Anwendung können Sie normalerweise die Symbolik eines Layers über ein Dialogfeld einstellen, wie z.B. in Abb. 4.12 gezeigt. In diesem Dialogfeld können Sie Farben und Symbolstile auswählen. Je nach Geometrietyp einer Ebene können unterschiedliche Optionen angezeigt werden. Bei Punktebenen können Sie zum Beispiel einen Markierungsstil wählen. Bei Linien- und Polygonebenen gibt es keine Option für den Markierungsstil, stattdessen können Sie einen Linienstil und eine Farbe auswählen, z. B. gestrichelt orange für Schotterstraßen, durchgezogen orange für Nebenstraßen usw. (wie in Abb. 4.13 gezeigt). Bei Polygonebenen haben Sie außerdem die Option, eine Einstellung für Füllstil und Farbe festzulegen.

../../_images/single_symbol_point.png

Abb. 4.12 Bei der Verwendung von einfachen Symbolen wird das Symbol dargestellt, ohne dass ein Attribut verwendet wird, um sein Aussehen zu steuern. Hier das Dialogfenster für Punkt-Symbole.

../../_images/single_symbol_poly.png

Abb. 4.13 Bei der Definition von einfachen Symbolen für Polylinien- und Polygon-Features gibt es verschiedene Optionen.

4.4. Abgestufte Symbole

Manchmal stellen Vektoren Objekte mit einem sich ändernden numerischen Wert dar. Höhenlinien sind ein gutes Beispiel dafür. Jede Linie hat normalerweise einen Attributwert namens „Höhe“, der Informationen darüber enthält, welche Höhe diese Linie darstellt. In einem früheren Abschnitt dieses Themas haben wir Linien gezeigt, die alle mit derselben Farbe gezeichnet wurden. Das Hinzufügen von Farben zu den Höhenlinien kann uns helfen, die Bedeutungen der Linien zu interpretieren. So können wir zum Beispiel niedrig gelegene Gebiete mit einer Farbe zeichnen, Gebiete in mittlerer Höhe mit einer anderen und hoch gelegene Gebiete mit einer dritten.

../../_images/graduated_symbol_settings.png

Abb. 4.14 Das Höhenattribut der Linien kann verwendet werden, um diese in 3 Klassen zu unterteilen. Höhenlinien zwischen 980 m und 1120 m werden in brauner Farbe gezeichnet, solche zwischen 1120 m und 1240 m in grüner Farbe und solche zwischen 1240 m und 1500 m in lila.

../../_images/graduated_symbol_map.png

Abb. 4.15 Die Karte nach Einstellung von abgestuften Farben für die Höhenlinien.

Setting colours based on discrete groups of attribute values is called Graduated Symbology in QGIS. The process is shown in Illustrations Abb. 4.14 and Abb. 4.15. Graduated symbols are most useful when you want to show clear differences between features with attribute values in different value ranges. The GIS Application will analyse the attribute data (e.g. height) and, based on the number of classes you request, create groupings for you. This process is illustrated in table_graduated.

Attributwert

Klasse und Farbe

1

Klasse 1

2

Klasse 1

3

Klasse 1

4

Klasse 2

5

Klasse 2

6

Klasse 2

7

Klasse 3

8

Klasse 3

9

Klasse 3

Table Graduated: Graduated colour breaks up the attribute value ranges into the number of classes you select. Each class is represented by a different colour.

4.5. Continuous Colour Symbols

In the previous section on Graduated Colour symbols we saw that we can draw features in discrete groups or classes. Sometimes it is useful to draw features in a colour range from one colour to another. The GIS Application will use a numerical attribute value from a feature (e.g. contour heights or pollution levels in a stream) to decide which colour to use. Table table_continuous shows how the attribute value is used to define a continuous range of colours.

Attributwert

Colour (no classes or grouping)

1

2

3

4

5

6

7

8

9

Table Continuous: Continuous colour symbology uses a start colour (e.g. light orange shown here) and an end colour (e.g. dark brown shown here) and creates a series of shades between those colours.

Using the same contours example we used in the previous section, let’s see how a map with continuous colour symbology is defined and looks. The process starts by setting the layers properties to continuous colour using a dialog like the one shown in Abb. 4.16.

../../_images/continuous_symbol_settings.png

Abb. 4.16 Setting up continuous colour symbology. The contour height attribute is used to determine colour values. Colours are defined for the minimum and maximum values. The GIS Application will then create a gradient of colours for drawing the features based on their heights.

After defining the minimum and maximum colours in the colour range, the colour features are drawn in will depend on where the attribute lies in the range between minimum and maximum. For example if you have contour features with values starting at 1000 m and ending at 1400 m, the value range is 1000 to 1400. If the colour set for the minimum value is set to orange and the colour for the maximum value is black, contours with a value of close to 1400 m will be drawn close to black. On the other hand contours with a value near to 1000 m will be drawn close to orange (see Abb. 4.17).

../../_images/continuous_symbol_map.png

Abb. 4.17 A contour map drawn using continuous colour symbology

4.6. Unique Value Symbols

Sometimes the attributes of features are not numeric, but instead strings are used. ‚String‘ is a computer term meaning a group of letters, numbers and other writing symbols. Strings attributes are often used to classify things by name. We can tell the GIS Application to give each unique string or number its own colour and symbol. Road features may have different classes (e.g. ‚street‘, ‚secondary road‘, ‚main road‘ etc.), each drawn in the map view of the GIS with different colours or symbols. This is illustrated in table_unique.

Attributwert

Colour class and symbol

Arterial route

Main road

Secondary road

Street

Table Unique: Unique attribute values for a feature type (e.g. roads) can each have their own symbol.

Within the GIS Application we can open/choose to use Unique Value symbology for a layer. The GIS will scan through all the different string values in the attribute field and build a list of unique strings or numbers. Each unique value can then be assigned a colour and style. This is shown in Abb. 4.18.

../../_images/unique_symbol_settings.png

Abb. 4.18 Defining unique value symbology for roads based on the road type.

When the GIS draws the layer, it will look at the attributes of each feature before drawing it to the screen. Based on the value in the chosen field in the attribute table, the road line will be drawn with suitable colour and line style (and fill style if its a polygon feature). This is shown in Abb. 4.19.

../../_images/unique_symbol_map.png

Abb. 4.19 A roads vector layer symbolised using a unique value per road type.

4.7. Things to be aware of

Deciding which attributes and symbology to use requires some planning. Before you start collecting any GeoSpatial data, you should ensure you know what attributes are needed and how it will be symbolised. It is very difficult to go back and re-collect data if you plan poorly the first time around. Remember also that the goal of collecting attribute data is to allow you to analyse and interpret spatial information. How you do this depends on the questions you are trying to answer. Symbology is a visual language that allows people to see and understand your attribute data based on the colours and symbols you use. Because of this you should put a lot of thought into how you symbolise your maps in order to make them easy to understand.

4.8. Was haben wir gelernt?

Lassen Sie uns zusammenfassen, was wir in diesem Arbeitsblatt behandelt haben:

  • Vector features have attributes

  • Attributes describe the properties of the feature

  • The attributes are stored in a table

  • Rows in the table are called records

  • There is one record per feature in the vector layer

  • Columns in the table are called fields

  • Fields represent properties of the feature e.g. height, roof colour etc.

  • Fields can contain numerical, string (any text) and date information

  • The attribute data for a feature can be used to determine how it is symbolised

  • Graduated colour symbology groups the data into discrete classes

  • Continuous colour symbology assigns colours from a colour range to the features based on their attributes

  • Unique value symbology associates each different value in the chosen attribute column with a different symbol (colour and style)

  • If the attribute of a vector layer is not used to determine its symbology, it is drawn using a single symbol only

4.9. Versuchen Sie es selbst!

Hier sind einige Ideen für Sie, die Sie mit Ihren Lernenden versuchen sollten:

  • Using the table that you created in the last topic, add a new column for the symbology type you would use for each feature type and have the learners identify which symbology type they would use (see table_example_symbols for an example).

  • Try to identify which symbology types you would use for the following types of vector features:

    • points showing pH level of soil samples taken around your school

    • lines showing a road network in a city

    • polygons for houses with an attribute that shows whether it is made of brick, wood or ‚other‘ material.

Real world feature

Geometrietyp

Symbology Type

The school flagpole

Punkt

Single Symbol

The soccer field

Polygon

Single Symbol

The footpaths in and around the school

Polyline

Have your learners count the number of learners using each footpath in the hour before school and then use graduated symbols to show the popularity of each footpath

Places where taps are located

Punkt

Single symbol

Classrooms

Polygon

Unique value based on the grade of the learners in the classroom

Fence

Polyline

Have your learners rate the condition of the fence around your school by separating it into sections and grading each section on a scale of 1-9 based on its condition. Use graduated symbols to classify the condition attribute.

Classrooms

Polygon

Count the number of learners in each classroom and use a continuous colour symbol to define a range of colours from red to blue.

Table Example Symbols: An example of a table that defines the feature types and the kind of symbology you would use for each.

4.10. Etwas zum nachdenken

If you don’t have a computer available, you can use transparency sheets and a 1:50 000 map sheet to experiment with different symbology types. For example place a transparency sheet over the map and using different coloured koki pens, draw in red all contour lines below 900 m (or similar) and in green all lines above or equal to 900 m. Can you think of how to reproduce other symbology types using the same technique?

4.11. Literaturhinweise

Website: https://en.wikipedia.org/wiki/Cartography

The QGIS User Guide also has more detailed information on working with attribute data and symbology in QGIS.

4.12. Wie geht es weiter?

In the section that follows we will take a closer look at data capture. We will put the things we have learned about vector data and attributes into practice by creating new data.