1 Open Source software and GIS ................................. 1
1.1 Open Source concept ..................................... 1
1.2 GRASS as an Open Source GIS ............................. 3
1.3 The North Carolina sample data set ...................... 5
1.4 How to read this book ................................... 5
2 GIS concepts ................................................. 7
2.1 General GIS principles .................................. 7
2.1.1 Geospatial data models ........................... 7
2.1.2 Organization of GIS data and system
functionality ................................... 11
2.2 Map projections and coordinate systems ................. 13
2.2.1 Map projection principles ....................... 13
2.2.2 Common coordinate systems and datums ............ 16
3 Getting started with GRASS .................................. 21
3.1 First steps ............................................ 21
3.1.1 Download and install GRASS ...................... 21
3.1.2 Database and command structure .................. 23
3.1.3 Graphical User Interfaces for GRASS 6: QGIS
and gis.m ....................................... 26
3.1.4 Starting GRASS with the North Carolina data
set ............................................. 27
3.1.5 GRASS data display and 3D visualization ......... 30
3.1.6 Project data management ......................... 34
3.2 Starting GRASS with a new project ...................... 37
3.2.1 Defining the coordinate system for a new
project ......................................... 40
3.2.2 Non-georeferenced xy coordinate system .......... 44
3.3 Coordinate system transformations ...................... 44
3.3.1 Coordinate lists ................................ 45
3.3.2 Projection of raster and vector maps ............ 47
3.3.3 Reprojecting with GDAL/OGR tools ................ 48
4 GRASS data models and data exchange ......................... 53
4.1 Raster data ............................................ 54
4.1.1 GRASS 2D and 3D raster data models .............. 54
4.1.2 Managing regions, raster map resolution and
boundaries ...................................... 56
4.1.3 Import of georeferenced raster data ............. 58
4.1.4 Import and geocoding of a scanned historical
map ............................................. 66
4.1.5 Raster data export .............................. 69
4.2 Vector data ............................................ 70
4.2.1 GRASS vector data model ......................... 70
4.2.2 Import of vector data ........................... 73
4.2.3 Coordinate transformation for xy CAD drawings ... 78
4.2.4 Export of vector data ........................... 80
5 Working with raster data .................................... 83
5.1 Viewing and managing raster maps ....................... 83
5.1.1 Displaying raster data and assigning a color
table ........................................... 83
5.1.2 Managing metadata of raster maps ................ 86
5.1.3 Raster map queries and profiles ................. 88
5.1.4 Raster map statistics ........................... 90
5.1.5 Zooming and generating subsets from raster
maps ............................................ 91
5.1.6 Generating simple raster maps ................... 92
5.1.7 Reclassification and rescaling of raster maps ... 94
5.1.8 Recoding of raster map types and value
replacements .................................... 97
5.1.9 Assigning category labels ....................... 99
5.1.10 Masking and handling of no-data values ......... 103
5.2 Raster map algebra .................................... 105
5.2.1 Integer and floating point data ................ 107
5.2.2 Basic calculations ............................. 108
5.2.3 Working with "if" conditions ................... 109
5.2.4 Handling of NULL values in r.mapcalc ........... 110
5.2.5 Creating a MASK with r.mapcalc ................. 111
5.2.6 Special graph operators ........................ 112
5.2.7 Neighborhood operations with relative
coordinates .................................... 113
5.3 Raster data transformation and interpolation .......... 115
5.3.1 Automated vectorization of discrete raster
data ........................................... 115
5.3.2 Generating isolines representing continuous
fields ......................................... 118
5.3.3 Resampling and interpolation of raster data .... 119
5.3.4 Overlaying and merging raster maps ............. 124
5.4 Spatial analysis with raster data ..................... 126
5.4.1 Neighborhood analysis and cross-category
statistics ..................................... 126
5.4.2 Buffering of raster features ................... 133
5.4.3 Cost surfaces .................................. 135
5.4.4 Terrain and watershed analysis ................. 140
5.4.5 Landscape structure analysis ................... 153
5.5 Landscape process modeling ............................ 155
5.5.1 Hydrologie and groundwater modeling ............ 155
5.5.2 Erosion and deposition modeling ................ 158
5.5.3 Final note on raster-based modeling and
analysis ....................................... 166
5.6 Working with voxel data ............................... 166
6 Working with vector data ................................... 169
6.1 Map viewing and metadata management ................... 169
6.1.1 Displaying vector maps ......................... 169
6.1.2 Vector map metadata maintenance ................ 172
6.2 Vector map attribute management and SQL support ....... 173
6.2.1 SQL support in GRASS 6 ......................... 174
6.2.2 Sample SQL queries and attribute
modifications .................................. 181
6.2.3 Map reclassification ........................... 185
6.2.4 Vector map with multiple attribute tables:
layers ......................................... 186
6.3 Digitizing vector data ................................ 187
6.3.1 General principles for digitizing topological
data ........................................... 187
6.3.2 Interactive digitizing in GRASS ................ 189
6.4 Vector map queries and statistics ..................... 192
6.4.1 Map queries .................................... 192
6.4.2 Raster map statistics based on vector
objects ........................................ 194
6.4.3 Point vector map statistics .................... 196
6.5 Geometry operations ................................... 196
6.5.1 Topological operations ......................... 197
6.5.2 Buffering ...................................... 203
6.5.3 Feature extraction and boundary dissolving ..... 204
6.5.4 Patching vector maps ........................... 205
6.5.5 Intersecting and clipping vector maps .......... 206
6.5.6 Transforming vector geometry and creating 3D
vectors ........................................ 209
6.5.7 Convex hull and triangulation from points ...... 211
6.5.8 Find multiple points in same location .......... 212
6.5.9 Length of common polygon boundaries ............ 214
6.6 Vector network analysis ............................... 216
6.6.1 Network analysis ............................... 216
6.6.2 Linear reference system (LRS) .................. 221
6.7 Vector data transformations to raster ................. 227
6.8 Spatial interpolation and approximation ............... 230
6.8.1 Selecting an interpolation method .............. 230
6.8.2 Interpolation and approximation with RST ....... 235
6.8.3 Tuning the RST parameters: tension and
smoothing ...................................... 237
6.8.4 Estimating RST accuracy ........................ 241
6.8.5 Segmented processing ........................... 244
6.8.6 Topographic analysis with RST .................. 247
6.9 Working with lidar point cloud data ................... 249
6.10 Volume based interpolation ............................ 257
6.10.1 Adding third variable: precipitation with
elevation ...................................... 258
6.10.2 Volume and volume-temporal interpolation ....... 261
6.10.3 Geostatistics and splines ...................... 262
7 Graphical output and visualization ......................... 263
7.1 Two-dimensional display and animation ................. 263
7.1.1 Advanced map display in the GRASS monitor ...... 263
7.1.2 Creating a 2D shaded elevation map ............. 266
7.1.3 Using display tools for analysis ............... 267
7.1.4 Monitor output to PNG or PostScript files ...... 269
7.2 Creating hardcopy maps with ps.map .................... 271
7.3 Visualization in 3D space with NVIZ ................... 273
7.3.1 Viewing surfaces, raster and vector maps ....... 273
7.3.2 Querying data and analyzing multiple
surfaces ....................................... 279
7.3.3 Creating animations in 3D space ................ 280
7.3.4 Visualizing volumes ............................ 283
7.4 Coupling with an external OpenGL viewer Paraview ...... 284
8 Image processing ........................................... 287
8.1 Remote sensing basics ................................. 287
8.1.1 Spectrum and remote sensing .................... 287
8.1.2 Import of image channels ....................... 291
8.1.3 Managing channels and colors ................... 292
8.1.4 The feature space and image groups ............. 295
8.2 Data preprocessing .................................... 297
8.2.1 Radiometric preprocessing ...................... 297
8.2.2 Deriving a surface temperature map from
thermal channel ................................ 300
8.3 Radiometric transformations and image enhancements .... 303
8.3.1 Image ratios ................................... 303
8.3.2 Principal Component Transformation ............. 305
8.4 Geometric feature analysis with matrix filters ........ 307
8.5 Image fusion .......................................... 310
8.5.1 Introduction to RGB and IHS color model ........ 310
8.5.2 Image fusion with the IHS transformation ....... 311
8.5.3 Image fusion with Brovey transform ............. 313
8.6 Thematic classification of satellite data ............. 314
8.6.1 Unsupervised radiometric classification ........ 316
8.6.2 Supervised radiometric classification .......... 319
8.6.3 Supervised SMAP classification ................. 322
8.7 Multitemporal analysis ................................ 323
8.8 Segmentation and pattern recognition .................. 326
9 Notes on GRASS programming ................................. 331
9.1 GRASS programming environment ......................... 331
9.1.1 GRASS source code .............................. 332
9.1.2 Methods of GRASS programming ................... 333
9.1.3 Level of integration ........................... 334
9.2 Script programming .................................... 335
9.3 Automated usage of GRASS .............................. 338
9.3.1 Local mode: GRASS as GIS data processor ........ 338
9.3.2 Web based: PyWPS - Python Web Processing
Service ........................................ 340
9.4 Notes on programming GRASS modules in С ............... 341
10 Using GRASS with other Open Source tools ................... 347
10.1 Geostatistics with GRASS and gstat .................... 348
10.2 Spatial data analysis with GRASS and R ................ 353
10.2.1 Reading GRASS data into R ...................... 355
10.2.2 Kriging in R ................................... 358
10.2.3 Using R in batch mode .......................... 363
10.3 GPS data handling ..................................... 364
10.4 WebGIS applications with UMN/MapServer and
OpenLayers ............................................ 365
A Appendix ................................................... 367
A.l Selected equations used in GRASS modules .............. 367
A.2 Landscape process modeling ............................ 381
A.3 Definition of SQLite-ODBC connection .................. 383
References ................................................. 385
Index ......................................................... 393
|