1.1. PCRaster maps, data types and display

1.1.1. Introduction

The aim of these exercises is to learn how Geographical Information Systems can be used for the analysis and synthesis of spatial data in physical geography, soil science, hydrology and environmental science. The emphasis is on the understanding of the methods of analysis rather than on data structures, methods of data storage or producing high quality graphic display.

The exercises use the PCRaster Python software.

1.1.2. Reading maps from disk and visualisation

To run the software, open a Python command prompt and type at the prompt:

from pcraster import * <Enter>

This loads the PCRaster module.

To use the PCRaster maps in the exercise data set, you need to be sure that the path in your Python command prompt is directing to the folder containing the exercise data set. In many Python environments you can set this in advance, using an option in the environment. But you can also set it on the fly.

To check your path, type (still at the Python command prompt):

import os <Enter>
print(os.getcwd())

If it prints the path to the folder with your data set, proceed below at ‘To use a map..’! If not, you can choose to set the path at the prompt, using os.chdir(stringWithPath), where stringWithPath defines the path, for instance:

os.chdir(r"C:\Exercises\MapAlgebra") <Enter>

Check your path again by typing:

print(os.getcwd())

If all is fine, continue below.

To use a map, you first need to read it from disk:

waterMap=readmap("water.map") <Enter>

which reads the file water.map and assigns it to the variable waterMap, which is stored in memory.

Now you can visualise the map by typing:

aguila(waterMap) <Enter>

The maps provided are: buildg.map, firestat.map, iswater.map, phreatic.map, rainstor.map, roads.map, topo.map, water.map, dump.map, isroad.map, logging.map, points.map, rainyear.map, soils.map, trees.map, wells.map.

Now read the isroad.map from disk using the same command and use a variable name isroadMap and display it. You can display as many maps as you like. If you want to have the same cursor position, however, on all maps, it is better to open them at once, by using multiple maps as input of the aguila command, for instance:

aguila(isroadMap,waterMap)

Click on the maps to find some cells where you would expect a bridge, the cross indicates the cursor position. You can select ‘Show cursor and values’ from the Aguila menu to retrieve cell values.

Read from disk and display topo.map. It is the digital elevation model of the area. Right-click on the legend and select ‘Edit draw properties..’ to change settings. For instance, change the display to contours.

Below, you find the meaning of the codes used on the maps.

buildg.map
0 no buildings
1 house
2 public building
3 tip
4 industry
5 mine

dump.map
0 no dump
1 dump

firestat.map
0 no station
1 fire-station

isroad.map
0 no road
1 road

iswater.map
0 no water
1 water

logging.map
0 no felling
1 felling

roads.map
0 no roads
1 dirt road
2 metalled road

soils.map
1 stream
2 swamp
3 lake
4 clay
5 silty clay
6 peat
7 sandy clay
8 gravel
9 sand
10 boulder clay

trees.map
0 open
1 pine
2 deciduous
3 mixed woods

water.map
0 dry land
1 streams
2 swamp
3 lakes

wells.map
0 no well
1 well

1.1.3. Data types

PCRaster uses data typing of the data in the database: each map has one of the six data types used attached to it. These data types help you and PCRaster to structure the data. See the table below.

data type

description of attributes

domain

example

boolean

boolean

0 (FALSE), 1 (TRUE)

suitable/unsuitable, visible/non visible

nominal

classified, no order

whole values

soil classes

ordinal

classified, order

whole values

succession stages, income groups

scalar

continuous, linear

real values

temperature, concentration

directional

continuous, directional

0 to 360 degrees

aspect

ldd

direction to neighbour cell

codes of directions

drainage networks


Question: What is the data type of buildg.map?

  1. boolean

  2. nominal

  3. ordinal

  4. scalar

  5. directional

  6. ldd

Correct answers: b

Feedback: Buildings is a classified data type without order, so it is a nominal data type.