68
GRASS GIS 6 Workshop: QGIS und GRASS GIS unter Windows + http://www.qgis.org http://grass.itc.it GRASS GIS 6 Beginner's Workshop by Otto Dassau, Stephan Holl, Paolo Zatelli and Jachym Cepicky

Grass Beginners Workshop

Embed Size (px)

Citation preview

Page 1: Grass Beginners Workshop

GRASS GIS 6

Workshop: QGIS und GRASS GIS unter Windows

+

http://www.qgis.org http://grass.itc.it

GRASS GIS 6Beginner's Workshop

byOtto Dassau, Stephan Holl, Paolo Zatelli and

Jachym Cepicky

Page 2: Grass Beginners Workshop

GRASS GIS 6

●  Introduction and first steps●  Import and export of geodata●  Vector data analysis with GRASS ●  Raster data analysis with GRASS●  Image analysis (optical)●  Visualization with nviz●  Creating analogue maps

GRASS Beginner's workshop

Page 3: Grass Beginners Workshop

GRASS GIS 6

Introduction and first steps● What is GRASS?● Installation● Starting GRASS● Graphical User Interfaces● GRASS database● Command structure● Help

Page 4: Grass Beginners Workshop

GRASS GIS 6

What is GRASS ­ complete open source geopraphical information system­ portable to GNU/Linux, MS­Windows, MacOS, SUN, ...­ documentation, sample data, tutorials in several languages­ headquarter located in Trento, Italy with world­wide community­ supports 2D, 3D raster, vector and imagery analysis 

Page 5: Grass Beginners Workshop

GRASS GIS 6

Installationcompair http://grass.itc.it/download/index.php

Source codedownload and compile grass and related software packages mostly with ./configuremakesudo make install 

 

BinariesGNU/Linux  (grass.rpm or grass.deb files) Mac OSXMS­Windows (.exe files)  ­ cygwin | Qgis

Page 6: Grass Beginners Workshop

GRASS GIS 6

Starting GRASS Starting GRASS by clicking on the desktop symbol          or type 

grass6 [­ *] from command line shell:

­ grass6 ­help > print help message­ grass6 ­text > text based interface and set as default­ grass6 ­gui > Tcl/Tk based graphical user interface­ grass6 > start GRASS in current settings­ grass6 /path/to/location/mapset/ > start directly in desired Location

In GRASS:­ d.m & > start GIS Manager from command line­ gis.m & > start new GIS Manager from command line 

Page 7: Grass Beginners Workshop

GRASS GIS 6

Graphical User Interfaces (d.m) Pulldown menuewith analysis tools Visualisation, Printing and

attribute management

Map legend

Definition of map visualisationDisplay current GRASS

commands

Page 8: Grass Beginners Workshop

GRASS GIS 6

Graphical User Interfaces (gis.m) 

Page 9: Grass Beginners Workshop

GRASS GIS 6

Graphical User Interfaces (QGIS) 

with GRASS Toolbox

GRASS Plugin

Page 10: Grass Beginners Workshop

GRASS GIS 6

GRASS database 

/home/user/grassdata

/europe

/hannover

/world

histdblncoor

sidxtopo

MapsetLocation

/kronsberg

GRASS Database

/prov_bz /meran

/huber

Geometry­ and attributdata

roads

forest

lakes

poi

roads.dbf

forest.dbf

poi.dbf

lakes.dbf

fcell

hist

colr

cell_misc

cellhd

cell

cats

vector

dbf

sqlite

Page 11: Grass Beginners Workshop

GRASS GIS 6

Command structure Prefix Function class Meaningg.* general general file operation commandsd.* display graphical display and visual queryr.* raster raster data processingr3.* raster volume (voxel) 3D raster data processing

v.net.* vector network vector network processing

v.* vector vector data processingi.* imagery imagery processing (remote sensing)p.* paint map design

ps.* postscript map design commands for postscript sizedb.* database database management modules

example:­ d.mon x0  # start monitor for visualisation­ g.region ­dp  # modify region extend to default­ r.in.gdal in=elevation.tif out=elevation  # import elevation map 

Page 12: Grass Beginners Workshop

GRASS GIS 6

Help 

short help with parameter ­help:

­ d.rast ­helpDescription:Keywords:Usage:Flags:Parameters:

detailed description with examples with module g.manual:

­ g.manual d.rast

Page 13: Grass Beginners Workshop

GRASS GIS 6

Import and export of geodata● GDAL/OGR ● Data import (vector, raster and sites)

– v.in.ogr for vectors– r.in.gdal for rasters

● Data export (vector, raster and sites)– v.out.ogr – r.out.gdal

Page 14: Grass Beginners Workshop

GRASS GIS 6

Raster data analysis with GRASS● Visualization● Map statistics● Raster analysis● Manipulating rastermaps

Page 15: Grass Beginners Workshop

GRASS GIS 6

Representation of raster data● Rasters represented as values organized into 

regular matrix● Each cell of the matrix has it's own value● Rasters are well suited for representation of 

smooth surfaces (DEM, rainfalls, temperature, ... maps)

Page 16: Grass Beginners Workshop

GRASS GIS 6

Raster representation of „real“ objects

Page 17: Grass Beginners Workshop

GRASS GIS 6

Visualization of raster maps

● There are two ways, how to display data in GRASS: – gis.m – new graphical user interface, without need to 

know command names– d.* commands – old way of displaing any kind of data 

in old „monitors“. Faster for advanced users.

Page 18: Grass Beginners Workshop

GRASS GIS 6

Visualization of raster maps ­ gis.m

Page 19: Grass Beginners Workshop

GRASS GIS 6

Visualization of raster maps ­ gis.m

Page 20: Grass Beginners Workshop

GRASS GIS 6

Visualization of raster maps ­ d.*

● Start the display monitor d.mon start=x0

● Show avaliable raster mapsg.list type=rast

● Display raster mapd.rast –helpd.rast map=soilsd.rast map=soils cat=3­4,8

● Displaying hillshading reliefd.his h=soils i=aspect

Page 21: Grass Beginners Workshop

GRASS GIS 6

Visualization of raster maps ­ d.*

Page 22: Grass Beginners Workshop

GRASS GIS 6

Basic raster statistics

● Basic informations about raster mapsr.info map=soils

● Information about raster categoriesr.cats map=soils

● Information about raster category valuesr.stats ­a ­c soils # print area totals, print cell counts

● Putting all togetherr.report soils units=me

Page 23: Grass Beginners Workshop

GRASS GIS 6

Basic raster analyzis

● Visualization of DEM rasterd.rast elevation.dem

● What is the elevation of point „x,y“ ?d.what.rast

ButtonsLeft:  what's hereRight: quit597030.65625(E) 4920661.21875(N)elevation.dem in PERMANENT  (1429)

Page 24: Grass Beginners Workshop

GRASS GIS 6

Basic raster analyzis ­ DEM

● Creation of aspect/slope mapr.slope.aspect ­­helpr.slope.aspect elev=elevation.dem slope=myslope aspect=myaspect

d.rast.leg mysloped.his h=myslope i=myaspect

Page 25: Grass Beginners Workshop

GRASS GIS 6

Basic raster analyzis ­ DEM

Page 26: Grass Beginners Workshop

GRASS GIS 6

Basic raster analyzis ­ DEM

● Basic flow analyzisr.flow elev=elevation.dem aspin=myaspect dsout=density

Page 27: Grass Beginners Workshop

GRASS GIS 6

Basic raster analyzis ­ DEM

Page 28: Grass Beginners Workshop

GRASS GIS 6

Basic raster analyzis

● Cross section (combining each category with each category)d.rast.leg soils.phd.rast.leg geologyr.cross in=geology,soils.ph out=geology_phd.rast.leg geology_ph

Page 29: Grass Beginners Workshop

GRASS GIS 6

Basic raster analyzis ­ r.mapcalc

● r.mapcalc newmap=“input_map1 .... input_map2 ....“

● Easy: r.mapcalc newdem=“elevation.dem/100“● Advanced: Low pass filter

r.mapcalc filt3x3=“ \(image[­1,­1]+image[­1,0],image[1,1]+ \image[0,­1]+image[0,0]+image[0,1]+ \image[1,­1]+image[1,0]+image[1,1] \)/9“

Page 30: Grass Beginners Workshop

GRASS GIS 6

Raster analyzis r.Display all 123 possibilities? (y or n)r.average r.in.gdal r.out.pov r.spreadpathr.basins.fill r.in.gridatb r.out.ppm r.statisticsr.bilinear r.in.mat r.out.ppm3 r.statsr.bitpattern r.in.poly r.out.tiff r.sumr.blend r.in.srtm r.out.vtk r.sunr.buffer r.in.wms r.param.scale r.sunmaskr.carve r.in.xyz r.patch r.supportr.cats r.info r.plane r.surf.arear.circle r.kappa r.profile r.surf.contourr.clump r.lake r.proj r.surf.fractalr.coin r.le.patch r.quant r.surf.idwr.colors r.le.pixel r.random r.surf.idw2....

Page 31: Grass Beginners Workshop

GRASS GIS 6

Vector data analysis with GRASS● Visualization● Attribute management● Digitizing● Data intersection, union and overlay● Data selection

Page 32: Grass Beginners Workshop

GRASS GIS 6

Visualization of vector maps ­ d.*

● Start the display monitor d.mon start=x0

● Show avaliable vector mapsg.list type=vect

● Display vector mapd.vect –helpd.vect map=soilsd.vect map=soils

● Try to use the gis.m or d.m to visualize vectors by yourself!

Page 33: Grass Beginners Workshop

GRASS GIS 6

Node

Node

Vertex

Vertex

SegmentSegment

Segment

Node

  Boundary

Vertex

Vertex

Vertex

Vertex

CentroidArea

Geometry­types in GRASS

Line

• Point• Centroid• Line• boundary• area• face• kernel 

Vector characteristics

•  Topology­support•  Dynamic creation of spatial index•  Creation of category index (IDs)•  Vector­network­support through DGLib

Page 34: Grass Beginners Workshop

GRASS GIS 6

VektorarchitekturVector architecture in GRASS 6

Page 35: Grass Beginners Workshop

GRASS GIS 6

Layerconcept in GRASS

Page 36: Grass Beginners Workshop

GRASS GIS 6

Attribute­table roads

Attribute­table soft_sholder1        attrib1

2       attrib21       attrib1

2        attrib2

1:1

catVector

Native format

line1

line2

1

12

112

Coor file

1:1

layer

GRASS 6.x Attributemanagement with multiple tables

22

Attribute management

Page 37: Grass Beginners Workshop

GRASS GIS 6

Digitize● Start the display monitor 

d.mon start=x0● Digitize new map

v.digit ­n my_new_map● Set attribute­table in settings● Digitize boundary and centroid

Page 38: Grass Beginners Workshop

GRASS GIS 6

Operator: ANDv.overlay ainput=soils binput=my_new_map out=mymap_union operator=and

v.overlay | union

Page 39: Grass Beginners Workshop

GRASS GIS 6

Operator: ORv.overlay ainput=soils binput=my_new_map out=mymap_intersection operator=or

v.overlay | intersection

Page 40: Grass Beginners Workshop

GRASS GIS 6

Operator: NOTv.overlay ainput=soils binput=my_new_map out=mymap_not operator=not

v.overlay | not

Page 41: Grass Beginners Workshop

GRASS GIS 6

Operator: XORv.overlay ainput=soils binput=my_new_map out=mymap_xor operator=xor

v.overlay | xor

Page 42: Grass Beginners Workshop

GRASS GIS 6

Attribute­management and data­selection

● Copy soils­dataset andg.copy vect=soils@PERMANENT,soils_cp

● Add (overwrite) new attribute­db to soils_cpv.db.connect ­o map=soils_cp table=soils_legend \ database=./soils_legend.db driver=sqlite key=id

● show attributes in terminalv.db.select soils_cp

● extract all soils in steep areav.extract in=soils_cp out=soils_steep type=area where="longname LIKE '%steep%'"

Page 43: Grass Beginners Workshop

GRASS GIS 6

Image analysis (optical)● Geocoding images● Image classification● Image fusion

Page 44: Grass Beginners Workshop

GRASS GIS 6

Geocoding images● i.group● i.target● i.points/

i.vpoints● i.rectify

Page 45: Grass Beginners Workshop

GRASS GIS 6

Image classification (unsupervised)

Landuse

Quality map

Landsat image

Images from Neteler M.

Page 46: Grass Beginners Workshop

GRASS GIS 6

Image classification (supervised)

result:Vegetation map

SMAP classification based on training areas

Page 47: Grass Beginners Workshop

GRASS GIS 6

Image fusion

Bozen, 26 Aug 2001LANDSAT-7 RGB/PAN Fusion

PAN

G,NIR,MIRImages from Neteler M.

Page 48: Grass Beginners Workshop

GRASS GIS 6

Visualization with nviz● Visualization of raster data● Visualization of vector data (points, lines)● Creating an animation

Page 49: Grass Beginners Workshop

GRASS GIS 6

NVIZ – Visualization of raster data

● Start NVIZnviz elevation=elevation.dem

Page 50: Grass Beginners Workshop

GRASS GIS 6

NVIZ – Visualization of raster data

Page 51: Grass Beginners Workshop

GRASS GIS 6

NVIZ – Visualization of raster data

Page 52: Grass Beginners Workshop

GRASS GIS 6

NVIZ – Visualization of raster data

Page 53: Grass Beginners Workshop

GRASS GIS 6

NVIZ – Visualization of raster data

Page 54: Grass Beginners Workshop

GRASS GIS 6

NVIZ – Visualization of raster data

Page 55: Grass Beginners Workshop

GRASS GIS 6

NVIZ – Visualization point data

Page 56: Grass Beginners Workshop

GRASS GIS 6

NVIZ – Visualization vector lines

Page 57: Grass Beginners Workshop

GRASS GIS 6

NVIZ – Visualization of polygons

© Martin Landa, 2005

Page 58: Grass Beginners Workshop

GRASS GIS 6

NVIZ ­­ Animation

● d.nviz:  Creates script suitable by NVIZ for generating animationd.nviz ­i ­k in=elevation.dem out=movie.nviz dist=500 ht=100 frames=200

Page 59: Grass Beginners Workshop

GRASS GIS 6

NVIZ ­­ Animation

Page 60: Grass Beginners Workshop

GRASS GIS 6

Creating analogue maps● Creating shading effects● Map export into a postscript map● Map export into a png map● Analogue maps with Quantum GIS

Page 61: Grass Beginners Workshop

GRASS GIS 6

Creating analogue maps – hillshading

● d.his ­­help...h_map   Name of layer to be used for HUE i_map   Name of layer to be used for INTENSITY...

● Aspect map:d.his h=elevation.dem i=aspect

● Shaded reliefr.shaded.relief map=elevation.dem shade=shaded.his h=elevation.dem i=shade

Page 62: Grass Beginners Workshop

GRASS GIS 6

Creating analogue maps – hillshading

Aspect map vs. shaded relief map

Page 63: Grass Beginners Workshop

GRASS GIS 6

Creating analogue maps – hillshading

● creating the map:ps.map ­e input=map.psmap out=map.eps

Page 64: Grass Beginners Workshop

GRASS GIS 6

Creating PostScript maps ­­ ps.mapraster soilscomments soil.txt where 1 6 font Helvetica endcolortable y where 1 6.5 cols 4 width 4 endvlines roads width 2 style 0111 color grey endvlegend where 4.5 0 fontsize 8 endtext 30% 100% SPEARFISH SOILS MAP color red endscale 1:125000paper a4 endend

Page 65: Grass Beginners Workshop

GRASS GIS 6

Creating analogue maps – PNG files

● export GRASS_WIDTH=800export GRASS_HEIGHT=600d.mon start=PNGd.rast soilsd.vect roads width=3 col=redd.mon stop=PNGdisplay map.png

Page 66: Grass Beginners Workshop

GRASS GIS 6

Creating analogue maps – PNG files

Page 67: Grass Beginners Workshop

GRASS GIS 6

Creating analogue maps – QGIS

Page 68: Grass Beginners Workshop

GRASS GIS 6

Workshop: QGIS und GRASS GIS unter Windows

+

http://www.qgis.org http://grass.itc.it

Thank you very much !

Otto Dassau, Stephan Holl, Paolo Zatelli and Jachym Cepicky