Grass Beginners Workshop
-
Upload
marcello-benigno -
Category
Documents
-
view
156 -
download
5
Transcript of 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
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
GRASS GIS 6
Introduction and first steps● What is GRASS?● Installation● Starting GRASS● Graphical User Interfaces● GRASS database● Command structure● Help
GRASS GIS 6
What is GRASS complete open source geopraphical information system portable to GNU/Linux, MSWindows, MacOS, SUN, ... documentation, sample data, tutorials in several languages headquarter located in Trento, Italy with worldwide community supports 2D, 3D raster, vector and imagery analysis
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 OSXMSWindows (.exe files) cygwin | Qgis
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
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
GRASS GIS 6
Graphical User Interfaces (gis.m)
GRASS GIS 6
Graphical User Interfaces (QGIS)
with GRASS Toolbox
GRASS Plugin
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
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
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
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
GRASS GIS 6
Raster data analysis with GRASS● Visualization● Map statistics● Raster analysis● Manipulating rastermaps
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)
GRASS GIS 6
Raster representation of „real“ objects
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.
GRASS GIS 6
Visualization of raster maps gis.m
GRASS GIS 6
Visualization of raster maps gis.m
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=34,8
● Displaying hillshading reliefd.his h=soils i=aspect
GRASS GIS 6
Visualization of raster maps d.*
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
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)
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
GRASS GIS 6
Basic raster analyzis DEM
GRASS GIS 6
Basic raster analyzis DEM
● Basic flow analyzisr.flow elev=elevation.dem aspin=myaspect dsout=density
GRASS GIS 6
Basic raster analyzis DEM
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
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“
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....
GRASS GIS 6
Vector data analysis with GRASS● Visualization● Attribute management● Digitizing● Data intersection, union and overlay● Data selection
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!
GRASS GIS 6
Node
Node
Vertex
Vertex
SegmentSegment
Segment
Node
Boundary
Vertex
Vertex
Vertex
Vertex
CentroidArea
Geometrytypes in GRASS
Line
• Point• Centroid• Line• boundary• area• face• kernel
Vector characteristics
• Topologysupport• Dynamic creation of spatial index• Creation of category index (IDs)• Vectornetworksupport through DGLib
GRASS GIS 6
VektorarchitekturVector architecture in GRASS 6
GRASS GIS 6
Layerconcept in GRASS
GRASS GIS 6
Attributetable roads
Attributetable 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
GRASS GIS 6
Digitize● Start the display monitor
d.mon start=x0● Digitize new map
v.digit n my_new_map● Set attributetable in settings● Digitize boundary and centroid
GRASS GIS 6
Operator: ANDv.overlay ainput=soils binput=my_new_map out=mymap_union operator=and
v.overlay | union
GRASS GIS 6
Operator: ORv.overlay ainput=soils binput=my_new_map out=mymap_intersection operator=or
v.overlay | intersection
GRASS GIS 6
Operator: NOTv.overlay ainput=soils binput=my_new_map out=mymap_not operator=not
v.overlay | not
GRASS GIS 6
Operator: XORv.overlay ainput=soils binput=my_new_map out=mymap_xor operator=xor
v.overlay | xor
GRASS GIS 6
Attributemanagement and dataselection
● Copy soilsdataset andg.copy vect=soils@PERMANENT,soils_cp
● Add (overwrite) new attributedb 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%'"
GRASS GIS 6
Image analysis (optical)● Geocoding images● Image classification● Image fusion
GRASS GIS 6
Geocoding images● i.group● i.target● i.points/
i.vpoints● i.rectify
GRASS GIS 6
Image classification (unsupervised)
Landuse
Quality map
Landsat image
Images from Neteler M.
GRASS GIS 6
Image classification (supervised)
result:Vegetation map
SMAP classification based on training areas
GRASS GIS 6
Image fusion
Bozen, 26 Aug 2001LANDSAT-7 RGB/PAN Fusion
PAN
G,NIR,MIRImages from Neteler M.
GRASS GIS 6
Visualization with nviz● Visualization of raster data● Visualization of vector data (points, lines)● Creating an animation
GRASS GIS 6
NVIZ – Visualization of raster data
● Start NVIZnviz elevation=elevation.dem
GRASS GIS 6
NVIZ – Visualization of raster data
GRASS GIS 6
NVIZ – Visualization of raster data
GRASS GIS 6
NVIZ – Visualization of raster data
GRASS GIS 6
NVIZ – Visualization of raster data
GRASS GIS 6
NVIZ – Visualization of raster data
GRASS GIS 6
NVIZ – Visualization point data
GRASS GIS 6
NVIZ – Visualization vector lines
GRASS GIS 6
NVIZ – Visualization of polygons
© Martin Landa, 2005
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
GRASS GIS 6
NVIZ Animation
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
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
GRASS GIS 6
Creating analogue maps – hillshading
Aspect map vs. shaded relief map
GRASS GIS 6
Creating analogue maps – hillshading
● creating the map:ps.map e input=map.psmap out=map.eps
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
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
GRASS GIS 6
Creating analogue maps – PNG files
GRASS GIS 6
Creating analogue maps – QGIS
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