You are on page 1of 13

Practical Exercise 7

Raster Structure

Department of Physical Geography and Ecosystems


Analysis, and GIS Centre at Lund University, Sweden

Introduction to Geographical Information Systems

GISA01
Raster Structure

7 Raster Structure

7.1. Purpose
The aim of this exercise is to provide you with an introduction to the raster structure.
More specifically, you will learn:
- About different types of rasters and different ways of georeferencing raster data sets.
- How to explore and query raster datasets in ArcCatalog and ArcMap.
- About vectorization (conversion from raster to vector) and rasterization (conversion
from vector to raster), how to perform these in ArcMap and learn their effects.

7.2. Data
In Moodle, you can find a zip-file with the name DATA7_Raster_Structure. Download
and save the file to your computer and use WinZip to unzip the files. The unzipped files
contain the following data:
noaa_color Tagged image file: .tif, .tfw, .xml., .aux.
noaa_nir Tagged image file: .tif, .tfw, .xml, .aux.
pop_scania ESRI GRID binary format: pop_scania and info (sub directories.),
.lyr.
scaniadem ESRI GRID ASCII format: .asc.
sweden_coastlines Shapefile: .shp,.dbf, .shx, .prj.
urban_scania Shapefile: .shp,.dbf, .shx, .prj.
Create a folder in your local working directory with the name 7_Raster_Structure (e.g.
C:\GISA01\Practical\7_Raster_Structure). It is recommended that you keep an organized
file structure on your computer.

Note: In this exercise you will be using the ArcGIS Spatial Analyst tool for
raster data analysis. If you did not do a complete install when you installed
ArcGIS, the extension will most probably not be available to you in ArcMap. To
check if Spatial Analyst is installed simply start ArcMap then click Tools >
Extensions and check if Spatial Analyst is available in the list of extensions. If
it is not available you will have to modify your installation of ArcGIS and
choose to install all extensions on your local hard drive.

15-01-2010 Copyright 2010. Lund University GIS Centre. All rights reserved. 1
Raster Structure

7.3. Background
A raster image is built up of an array of pixels or cells organized in columns and rows.
Each cell has a value or a numerical attribute that represents a characteristic of that
location. The cell value might for instance represent height above sea level, mean annual
or mean monthly temperature or the type of land use. In some cases the cell value might
even contain an id-number linked to an attribute table with multiple attributes for each
number.
Several formats are used to store raster datasets. The ESRI GRID format, developed by
ESRI, comes in two formats: an ASCII format and a binary format. The relatively
uncomplicated ASCII format is basically a text file that can be loaded and viewed in
simple text editors. The first six lines in the ASCII file contain supplemental data that
holds information regarding the referencing or location of the data (the amount of
columns and rows, minimum x and maximum y coordinates and cell size). The ESRI
GRID binary format is a little less straightforward as it is comprised of a multi file
structure that utilizes subdirectories with folders. Other common formats include bitmaps
such as .tif or .tiff (tagged image file format) and .bil (binary interleaved format).
In order to display and interpret raster images and to be able to perform any kind of
analyses together with other data, metadata is needed for:
- The number of columns and rows.
- The cell size or resolution.
- Referencing data (projection, x and y coordinates for specific locations etc).
- Data type and format.
- Documentation that describes what cell values represents.
The points listed above are what basically differentiate geographical raster data from
plain images or photographs. By multiplying the number of columns with the number of
rows, the number of cells that the image contains is given. The file size for the image is
then equal to the number of cells multiplied by the number of bytes used to store each
cell value.
A raster image may be a single band image or multiband image. In the latter case, a basic
example is an image that holds several different spectral ranges of light (for instance one
for red light, another for green and another one for blue). Each pixel in the image will
thus hold three pieces of data for the same location.
Finally, conversion from vector to raster or raster to vector is rather straightforward. The
precision of the data might however be lost in the process. The resolution of the cells is of
utmost importance when it comes to converting raster to vector. A raster image with a
cell resolution of 10 m provides a much better accuracy of the output conversion than an

15-01-2010 Copyright 2010. Lund University GIS Centre. All rights reserved. 2
Raster Structure

image with a resolution of 100 m. However, the storage needed for a 10 m resolution
image is 102 times greater than a 100 m resolution image.

7.4. Answers to be sent to teachers


All students have to send in answers for questions 7.1 7.15 by email to the teachers as
indicated in the document Sending Answers to Teachers available in the section Course
Information on the course homepage.

7.5. Method

7.5.1. Exploring and viewing the data


- Start ArcCatalog and navigate to or create a folder connection to the folder
containing the data for this exercise.
Observe that the symbols used to represent vector and raster datasets look different from
each other. The satellite image file NOAA_color is a multiband image consisting of three
rasters that constitutes a RGB (red, green, blue) image. By clicking the plus sign to the
left of the filename NOAA_color in the catalog tree the three rasters can be previewed
separately.
- Right click NOAA_color in the catalog tree, select Properties and try to answer
the questions below.

Question 7.1: How many columns and rows does the satellite image have?

Question 7.2: How many cells does the image have?

Question 7.3: What type of projection is used?

Question 7.4: What is the cell resolution?

Question 7.5: What data type is used to store the cell values?

It is almost impossible to correctly interpret a raster dataset if not all essential information
is provided in the metadata.
- Take a look at the metadata for the file NOAA_color and try to answer the
questions below.

15-01-2010 Copyright 2010. Lund University GIS Centre. All rights reserved. 3
Raster Structure

Question 7.6: What is the name of the satellite sensor that acquired the image?

Question 7.7: What are the extent coordinates of the image in decimal degrees (west,
east, north and south)?

The attributes or the cell values in the image NOAA_color represent spectral radiance
(surface brightness). However, the cell values have been scaled. This basically means that
the magnitude of the numbers has been changed in order to store the image in a data type
that is less space consuming. To recalculate the current cell values to spectral radiance
you need to apply an equation. The equation is available in the metadata.

Question 7.8: What is the spectral radiance in mW/cm2 sr m if the cell value
equals 120?

7.5.2. World files and headers


- Start ArcMap in ArcCatalog, choose to open A new empty map and add the
shapefile Sweden_coastlines and the image NOAA_color.
You should now be able to see the borders of Sweden and the image NOAA_color in the
map display window. The data are in the coordinate system RT90.
- Now add the image NOAA_nir to your map document then zoom to Full Extent.

15-01-2010 Copyright 2010. Lund University GIS Centre. All rights reserved. 4
Raster Structure

As you might notice the NOAA_nir image is misplaced. This is because the referencing
data has not been specified correctly. A raster image with no proper referencing data is
placed with the center of the upper left pixel at the origin (0, 0).
The image NOAA_nir is a .tif file and is accompanied by a world file with the same prefix
but with a different extension (.tfw). A world file is a plain text file that describes how the
image should be positioned or located. It contains information about the cell size, two
rotational parameters and the coordinates for the center of the upper left cell. The
contents of a world file could for instance look similar to this:

30 First row contains information about the


pixel/cell size in x-direction
0 Second row contains information on rotation
about the y-axis
0 Third row contains information on rotation
about the x-axis
-30 Fourth row the pixel/cell size in y-direction

1387671 Fifth row the x-coordinate of the center of the


upper left pixel/cell
6180000 Sixth row the y-coordinate of the center of the
upper left pixel/cell

Note: You can read more about world files for raster datasets in ArcGIS
Desktop Help.

15-01-2010 Copyright 2010. Lund University GIS Centre. All rights reserved. 5
Raster Structure

You will now perform an image to world transformation for the image NOAA_nir. World
files can be opened through using a simple text editor such as Notepad.
- Open the world file for NOAA_color and use the parameters in that file to
correct the parameters in the world file for the image NOAA_nir.
- Remove the image NOAA_nir from ArcMap and add it again once you have
edited and saved the world file. When you add the image again, it should be
placed at the correct position.

Question 7.9: What are the correct coordinates for the center of the upper left cell
for the NOAA images (easting and northing)?

The ASCII file Scaniadem is a raster file that can be loaded and viewed in simple text
editors.
- Open the file Scandiadem in Notepad.

Unfortunately, the file Scandiadem cannot be loaded and viewed in ArcMap. But the
main point here is that the referencing information is stored as a header with six lines
within the file itself. And just as with the world file, this information is used by ArcGIS
to correct the position of the data.

7.5.3. Exploring raster data in ArcMap


As you have previously learned, raster is a convenient format to use for continuously
varying data like temperature, precipitation or elevation. Such rasters are usually created
through interpolation. Interpolation is a procedure where values of cells are predicted by
using points of sampled data.

15-01-2010 Copyright 2010. Lund University GIS Centre. All rights reserved. 6
Raster Structure

The binary raster dataset Pop_scania hold values of accumulated population data from
points. This dataset provides a fairly good overview of population densities around areas
in the southern part of Sweden.
- Add the raster Pop_scania in ArcMap.
The raster Pop_scania is accompanied by a layer file (.lyr) with saved visual properties
for the particular raster.
- Right click Pop_scania in the Table of Contents (TOC) and choose Properties.
- In the dialog window Layer Properties click the tab Symbology and in the box
Show to the left click Classified. Finally, click Import and in the Import
Symbology dialog window choose to open the .lyr file Pop_scania. Click Ok
twice to apply.
The raster Pop_scania should now be visualized as red colors.

- Right click Pop_scania in the TOC and choose Zoom to Layer then use the
Identify tool in the Tools toolbar to get information on the total population
(pixel value) within different cells.
- Right click Pop_scania and choose to open its attribute table.
There are three default fields in the table. These are Rowid, VALUE and COUNT. It is not
possible to edit values within these fields. You might notice that the raster dataset is

15-01-2010 Copyright 2010. Lund University GIS Centre. All rights reserved. 7
Raster Structure

rather general with only 26 different population values ranging from 0 to 9000 in the field
or column VALUE. COUNT represents the number of cells in Pop_scania with the
specific cell value in the VALUE field.
- Right click Pop_scania in the TOC and choose Properties.
- In the dialog window Layer Properties click the tab Symbology and in the box
Show to the left click Classified.
Take a look in the box with symbols, ranges and labels. The raster Pop_scania is
displayed thematically and cell values have been grouped into ten different classes. For
example, the second class with the label 10 30 contains all cells with values higher than
10 up to values equaling 30. While the third class 30 90 contains all cells with values
higher than 30 to values equaling 90.

Question 7.10: According to the attribute table, how many cells belong to the second
class (population values ranging from 10 - 30)?

- Activate the Spatial Analyst extensions if it is not yet activated (Tools >
Extension), then choose to display the Spatial Analyst toolbar (View >
Toolbars).
- Make sure that Pop_scania is selected as Layer in the Spatial Analyst toolbar
and then click Histogram .

Histograms of raster data are particularly useful when you want to examine the
distribution of your data. In this case, the number of cells that fall within each of the 10
classes is represented by the height of the bars.

15-01-2010 Copyright 2010. Lund University GIS Centre. All rights reserved. 8
Raster Structure

Tip: You can change the appearance and properties of the graph by right
clicking the graph or its title bar and selecting Properties or Advanced
Properties.

7.5.4. Comparing raster and vector data


- Add the shapefile Urban_scania to your map document.

The polygon shapefile Urban_scania represents minor and major towns and cities in the
southern part of Sweden. If you zoom in on one of the polygons it is rather clear that the
raster image, as it is a continuous surface, contains population information both within
and outside polygons. This is one of the main advantages of the raster format, its ability
to represent continuous data. Within vector polygons, attributes are considered to be
homogenous although population values are likely to vary within them. However, it is
important to remember that the raster dataset is more spatially inaccurate than the
polygon shapefile due to the size of the cells.
- Open the attribute table for the shapefile Urban_scania and locate and select
the record with the URBAN_NAME Flyinge (FID 191). Then right click
Urban_scania in the TOC and click Selection > Zoom to Selected Features.

15-01-2010 Copyright 2010. Lund University GIS Centre. All rights reserved. 9
Raster Structure

Question 7.11: What is the population of Flyinge according to vector polygon layer
Urban_scania?

- Now estimate the total population of Flyinge in the raster data. Use Identify in
the Tools toolbar and sum the attribute values for the cells that cover, or partly
cover, the polygon that represent Flyinge.

Question 7.12: How many people are living in Flyinge according to the raster
dataset Urban_scania?

7.5.5. Rasterization and vectorization


It is possible to convert a raster dataset to vector (vectorization) and vice versa
(rasterization). In both cases, the spatial accuracy of the input dataset is of utmost
importance. For instance, the higher the spatial resolution of the cells (the smaller the
cells) the better the result of the vectorization.
- Add the raster data set Urban_raster to your map document.

15-01-2010 Copyright 2010. Lund University GIS Centre. All rights reserved. 10
Raster Structure

This layer is a rasterized version of the shapefile Urban_scania. The cell size in this
raster dataset is 500 x 500 m. During the rasterization process cells were set to be part of
a polygon feature if more than 50% of the grid cell was covered by the polygon. This is a
generalization option that can be used to derive a somewhat better precision of the output
borders and areas.
- Clear any selected features (Selection > Clear Selected Features).
- Open the attribute table for the shapefile Urban_scania. Locate, select and
zoom in on the feature with the URBAN_NAME Torekov (FID 3).

Question 7.13: What is the area of Torekov according to the polygon layer (in
square meters)?

- Open the attribute table for Urban_raster and select the record with Rowid 4
and take note of the number of cells in the field Count. Then calculate the total
area (remember that the cell size in Urban_raster is 500 x 500 m).

Question 7.14: How big is the village Torekov according to the raster layer (in
square meters)?

Study the difference between the raster dataset and the vector shapefile and see if you can
notice traces of the implemented 50% generalization rule.
You will now convert the polygon features in Urban_scania to raster but with a specified
cell size of 250 x 250 m.
- First off, clear any selected features.
- In the Spatial Analyst toolbar click Spatial Analyst > Convert > Features to
Raster.
- In the Features to Raster dialog window make sure Urban_scania is selected as
Input feature and then choose UrbanID in the drop down menu Field. This is
the attribute on which you will base the rasterization. Set Output cell size to
250, give your raster the name Urban_250 and make sure to save it together
with the other data for this exercise. Finalize by clicking OK.
- Now open the attribute table for your newly created raster Urban_250. Locate
the record with the Value 3116, and take note of the number of cells.

15-01-2010 Copyright 2010. Lund University GIS Centre. All rights reserved. 11
Raster Structure

Question 7.15: What is the area of Torekov with a cell resolution of 250 m?

Your final task in this exercise will be to re-convert the village Torekov in Urban_250
back to a vector polygon in two different ways.
- Open the attribute table for Urban_250 and select the record that represent
Torekov (Value 3116).
- In the Spatial Analyst toolbar click Spatial Analyst > Convert > Raster to
Features. Specify the required parameters and make sure to uncheck Generalize
lines. Give the output an appropriate name and click OK to finalize.
The polygon feature you just created should now have the exact same appearance as the
raster cells in Urban_250.
- Repeat the raster to feature conversion, but this time make sure Generalize lines
is checked.
Take a look at the output. In this case ArcGIS uses a generalization algorithm that gets
rid of the stair-cased look in the raster so that polygon boundaries are created with
straight lines. The Generalize line option should however be used with caution. If we for
instance were to have many isolated cells with many different cell values it would create
a lot of little triangles, which might not always be very appropriate.

End of Practical Exercise 7

Send your answers to the teacher as instructed

15-01-2010 Copyright 2010. Lund University GIS Centre. All rights reserved. 12

You might also like