Course 12.2Lesson 3 of 3
A GIS stacks layers of one coordinate system. Vector layers hold points, lines and polygons with a table of attributes, and raster layers hold a grid of cells. A geotransform places the cells, map algebra combines them, and a flood map must follow connections between cells.
Try the code and the simulations beside the lesson.
A city planner wants a new hospital. She needs the roads, the flood zones, the land value, the population and the height of the ground. Each of these is a layer: one theme, over one area. A geographic information system (GIS) stores the layers, lines them up, and answers questions across them: where is the land flat, away from floods, within of a road? The layers line up only when they share one coordinate reference system (CRS), a datum and a projection together.
A vector layer holds shapes made from coordinates:
Each shape is a row of an attribute table. The columns are fields: a name, a population, a land use. A query picks rows by their fields, or by their place.
Common operations:
The area of a polygon with corners , listed in order round the edge, is given by the shoelace formula. Add up the terms round the polygon, and take half of the size of the sum:
It is valid only if the coordinates are in metres on a plane. In degrees it gives a meaningless number. So project the layer first, with an equal-area or a local UTM system.
A raster layer is a grid of cells with one value in each. The value may be a height, a temperature, a land-cover class or a reflectance. The cells have a size , and there are rows and columns.
How do the cells find the ground? Through the geotransform. It gives the coordinates of the upper left corner of the grid and the cell size. The cell in column and row has its centre at
Rows are counted down from the top, and the north coordinate falls as the row number grows.  If the raster is rotated, the geotransform has two more terms, which together make an affine transformation. A cell of a raster of has an area of . A small cell size gives more detail, a bigger file, and less light per pixel for a sensor. A raster has a NoData value for cells without a measurement. Common file types are GeoTIFF for rasters, GeoJSON and shapefile for vectors.
Operations on rasters come in kinds, by the part of the grid that each output cell uses.
The slope at a cell comes from the heights of its neighbours. With central differences, for cells apart, the east-west and north-south rises per metre are and :
The gradient in percent is . A 3 by 3 window with weights on the neighbouring cells is Horn's method, which is less sensitive to a single bad cell.
A weighted overlay builds a suitability score from layers that are scored on one scale: with weights that add up to .
A sea-level map has a trap. A cell that lies below the new sea level floods only if the water can reach it, through cells that are also below the level. A pit behind a hill stays dry. So we start at the sea and spread to the neighbours that share an edge.
An old map comes as a picture, with positions in pixels . To place it, we pick ground control points, places whose map coordinates we know. An affine transformation , has six numbers. Three points that do not lie on one line give six equations, which fix the numbers. A fourth point left out of the fit shows the residual error.
A scene has the corner and cells of . Find the centre of the cell in column and row .
Make the cell size . How does the area of the whole raster change? What stays the same?
The program finds the area of a field from its corners with the shoelace formula, and then floods a small coast. It counts the low cells and the cells that the sea reaches.
Try each one on your own first. If you are stuck, open a hint. Then check with Show the answer.
Every lesson is open to read. Enrolling also lets you:
Log in to join the discussion.
Loading…
This lesson is free to read. Enroll free to keep your place and take the tests.