OPEN SOURCE GIS: a GRASS GIS APPROACH, Second Edition
Total Page:16
File Type:pdf, Size:1020Kb
Open Source GIS: A GRASS GIS Approach OPEN SOURCE GIS: A GRASS GIS APPROACH Second Edition MARKUS NETELER ITC-irst – Centro per la Ricerca Scientifica e Tecnologica, Italy HELENA MITASOVA North Carolina State University, U.S.A. KLUWER ACADEMIC PUBLISHERS NEW YORK, BOSTON, DORDRECHT, LONDON, MOSCOW eBook ISBN: 1-4020-8065-4 Print ISBN: 1-4020-8064-6 ©2005 Springer Science + Business Media, Inc. Print ©2004 Kluwer Academic Publishers Boston All rights reserved No part of this eBook may be reproduced or transmitted in any form or by any means, electronic, mechanical, recording, or otherwise, without written consent from the Publisher Created in the United States of America Visit Springer's eBookstore at: http://ebooks.kluweronline.com and the Springer Global Website Online at: http://www.springeronline.com to our friends and to all GRASS developers, present and past Contents List of Figures xiii List of Tables xix Foreword xxi Preface to the First Edition xxv Preface to the Second Edition xxvii Acknowledgments xxix 1. OPEN SOURCE SOFTWARE AND GIS 1 1.1 Open Source concept 1 1.2 GRASS as an Open Source GIS 3 1.3 How to read this book 4 2. GIS CONCEPTS 7 2.1 General GIS principles 7 2.1.1 Geospatial data models 7 2.1.2 Organization of GIS data 11 2.1.3 GIS functionality 12 2.2 Map projections and coordinate systems 13 2.2.1 Map projection principles 14 2.2.2 Common coordinate systems 17 2.2.3 North American and European Datums 20 3. GETTING STARTED WITH GRASS 23 3.1 First steps 23 3.1.1 Download and install GRASS 23 3.1.2 Database and command structure 25 3.1.3 Starting GRASS with demo database Spearfish 28 3.1.4 GRASS file and location management 31 3.2 Starting GRASS with a new project 34 3.2.1 Latitude-Longitude 35 3.2.2 Universal Transverse Mercator 39 viii OPEN SOURCE GIS 3.2.3 State Plane 42 3.2.4 Non-georeferenced xy coordinate system 44 3.3 Coordinate system transformations 45 3.3.1 Coordinates lists 46 3.3.2 Map layers 48 3.3.3 Reprojecting with GDAL/OGR tools 49 4. GRASS DATA MODELS AND DATA EXCHANGE 53 4.1 Raster data 53 4.1.1 GRASS raster data model 53 4.1.2 Managing raster map resolution and boundaries 55 4.1.3 Import of georeferenced raster data 57 4.1.4 Import and geocoding of scanned maps 61 4.1.5 Export 67 4.2 Vector data 68 4.2.1 GRASS vector data model 68 4.2.2 Import of vector data 70 4.2.3 Export of vector data 78 4.3 Sites data 80 4.3.1 GRASS sites data model 80 4.3.2 Import of sites data 81 4.3.3 Export of sites data 83 5. WORKING WITH RASTER DATA 85 5.1 Viewing and managing raster map layers 85 5.1.1 Displaying raster data and assigning a color table 85 5.1.2 Raster map queries and profiles 87 5.1.3 Zooming and generating subsets from raster maps 88 5.1.4 Managing metadata of raster maps 90 5.1.5 Reclassification of raster maps 91 5.1.6 Assigning category labels 93 5.1.7 Masking and handling of no-data values 97 5.2 Raster map algebra 99 5.3 Raster data transformation and interpolation 105 5.3.1 Automated vectorization of discrete raster data 105 5.3.2 Generating isolines representing continuous fields 107 5.3.3 Raster data transformation to sites 108 5.3.4 Interpolation of raster data and resampling 108 5.3.5 Recoding of raster map types and value replacements 110 5.4 Spatial analysis with raster data 111 5.4.1 Map statistics and neighborhood analysis 111 5.4.2 Overlaying and merging raster maps 115 Contents ix 5.4.3 Buffering of raster features 118 5.4.4 Cost surfaces 120 5.4.5 DEM and watershed analysis 123 5.4.6 Landscape structure analysis and modeling 129 6. WORKING WITH VECTOR DATA 131 6.1 Digitizing vector data 131 6.1.1 General principles for digitizing topological data 132 6.1.2 Digitizing in GRASS 133 6.2 Metadata and attributes management 139 6.2.1 Managing metadata of vector maps 140 6.2.2 Map attributes modifications 140 6.3 Viewing and analysis 141 6.3.1 Displaying vector map layers 141 6.3.2 Intersecting and clipping vector maps 142 6.3.3 Map reclassification 144 6.3.4 Feature extraction from vector data 145 6.4 Vector data transformations to/from raster and sites 145 6.4.1 Automatic vectorization of raster data 146 6.4.2 Direct transformation of vector data to raster or sites 147 6.4.3 Interpolating raster surfaces from contour lines 147 7. WORKING WITH SITE DATA 151 7.1 Creating site data 151 7.1.1 Digitizing site data 151 7.1.2 Generating site data within GRASS 152 7.2 Viewing and managing site data 154 7.2.1 Displaying site data and creating subsets 154 7.2.2 Computing basic statistics 156 7.3 Transformation from sites to rasters and spatial interpolation 157 7.3.1 Selecting an interpolation method 157 7.3.2 Interpolating with RST: tuning the parameters 160 7.3.3 Estimating accuracy 165 7.3.4 Interpolating large data sets 166 7.3.5 Surfaces with faults 171 7.3.6 Adding third variable: precipitation with elevation 171 7.3.7 Volume and volume-temporal interpolation 174 7.3.8 Geostatistics and splines 175 8. GRAPHICAL OUTPUT AND VISUALIZATION 177 8.1 Two-dimensional display and animation 177 8.1.1 Displaying map layers using the GRASS monitor 177 8.1.2 Creating a 2D shaded elevation map 180 x OPEN SOURCE GIS 8.1.3 Monitor output to PNG and HTML files 181 8.1.4 Animations in 2D space 183 8.2 Visualization in 3D space with NVIZ 184 8.2.1 Viewing multiple map layers 184 8.2.2 Querying and analyzing data in nviz 189 8.2.3 Creating animations in 3D space 191 8.2.4 Visualizing volumes 195 8.3 Creating hardcopy maps 196 8.3.1 Map generation with ps.map 196 8.3.2 Map design with Xfig and Skencil 198 9. SATELLITE IMAGE PROCESSING 201 9.1 Remote sensing basics 201 9.1.1 Spectrum and remote sensing 201 9.1.2 Satellite sensors 203 9.2 Satellite data import and export 206 9.2.1 Import of raw and geocoded satellite data 206 9.2.2 Export of multi-channel data sets 209 9.3 Understanding a satellite data set 209 9.3.1 Managing channels and colors 209 9.3.2 The feature space and image groups 213 9.4 Geometric and radiometric preprocessing 215 9.4.1 Geometric preprocessing 215 9.4.2 Radiometric preprocessing 222 9.4.3 Application: Deriving a surface temperature map from thermal channel 228 9.5 Radiometric transformations and image enhancements 231 9.5.1 Image ratios 231 9.5.2 Principal Component Transformation 231 9.6 Geometric feature analysis 233 9.6.1 Matrix filter: Spatial convolution filtering 234 9.6.2 Edge detection 236 9.7 Image fusion 237 9.7.1 Introduction to RGB and IHS color model 237 9.7.2 RGB color composites 238 9.7.3 Image fusion with IHS transformation 239 9.7.4 Image fusion with Brovey transformation 241 9.8 Thematic reclassification of satellite data 242 9.8.1 Unsupervised radiometric reclassification 245 9.8.2 Supervised radiometric reclassification 248 9.8.3 Supervised SMAP reclassification 251 Contents xi 10. PROCESSING OF AERIAL PHOTOS 253 10.1 Brief introduction to aerial photogrammetry 253 10.2 From aerial photo to orthophoto 257 10.3 Orthophoto generation 257 10.3.1 Aerial photo and LOCATIONs preparation 258 10.3.2 Orthophoto generation from vertical aerial photos 260 10.3.3 Generating orthophotos from oblique aerial photos 266 10.4 Segmentation and pattern recognition for aerial images 268 11. NOTES ON GRASS PROGRAMMING 271 11.1 GRASS programming environment 271 11.1.1 GRASS source code 272 11.1.2 Methods of GRASS programming 273 11.1.3 Level of integration 273 11.2 Script programming 274 11.3 Automated usage of GRASS 280 11.4 Notes on programming GRASS modules in C 282 12. USING GRASS: APPLICATION EXAMPLES 289 12.1 Working with Digital Elevation Models: erosion risk assessment 289 12.1.1 Computation of the LS factor 290 12.1.2 Estimating R, K, and C factors 296 12.1.3 Computing and analyzing erosion risk 298 12.2 GIS modeling for land management 301 12.2.1 Building the GIS database 302 12.2.2 Deriving new map layers 308 12.2.3 Land use analysis, problems and solutions 316 13. USING GRASS WITH OTHER OPEN SOURCE TOOLS 327 13.1 Geostatistics with GRASS and gstat 328 13.2 Spatial data analysis with GRASS and R 333 13.2.1 Spearfish data set analysis 335 13.2.2 Maas river bank soils data analysis 344 13.2.3 Using R in batch mode 352 13.3 GPS data handling 354 13.4 WebGIS applications with UMN/MapServer 356 References 359 Appendices 367 A Using UNIX text tools for GIS data preparation 367 xii OPEN SOURCE GIS B Selected equations used in GRASS modules 371 B.1 Basic Statistics 371 B.2 Interpolation 372 B.3 Topographic analysis 373 B.4 Insolation 378 C UMN/MapServer sample configuration 383 C.1 UMN/MapServer definition file 383 C.2 UMN/MapServer HTML template 386 Index 389 List of Figures 1.1 GRASS Development Model 4 2.1 Data models in GIS: raster, vector, point data and attributes 8 2.2 Data dimensions in a GIS 11 2.3 Earth’s surface representation in map projections and coordinate systems 15 2.4 Example for Gauss-Krüger Grid System 20 3.1 Organization of GRASS DATABASE, LOCATIONs and MAPSETs 26 3.2 Graphical startup of GRASS 29 3.3 GRASS used in the KDE environment on GNU/Linux 30 3.4 Spearfish soil raster map with overlayed vector streams and archeological sites 31 3.5 GRASS text-based startup screen 34 3.6 Definition of a xy and a projected LOCATION 36 3.7 Definition of a region for xy LOCATION suitable for importing an image or scanned map 45 4.1 Types of raster data 54 4.2 Sample workflow to import GIS data and to geocode scanned maps 63 4.3 Geocoding of a scanned map 65 4.4 Vector types in GIS: vector line and vector area 68 5.1 “Moving window” method for neighborhood opera- tions in raster map algebra 101 5.2 Modules for transformation of different types of raster data to vector