Mastering Geospatial Development with QGIS 3.x - Third Edition

Book description

Go beyond the basics and unleash the full power of QGIS 3.4 and 3.6 with practical, step-by-step examples

Key Features

  • One-stop solution to all of your GIS needs
  • Master QGIS by learning about database integration, and geoprocessing tools
  • Learn about the new and updated Processing toolbox and perform spatial analysis

Book Description

QGIS is an open source solution to GIS and widely used by GIS professionals all over the world. It is the leading alternative to proprietary GIS software. Although QGIS is described as intuitive, it is also, by default, complex. Knowing which tools to use and how to apply them is essential to producing valuable deliverables on time.

Starting with a refresher on the QGIS basics and getting you acquainted with the latest QGIS 3.6 updates, this book will take you all the way through to teaching you how to create a spatial database and a GeoPackage. Next, you will learn how to style raster and vector data by choosing and managing different colors. The book will then focus on processing raster and vector data. You will be then taught advanced applications, such as creating and editing vector data. Along with that, you will also learn about the newly updated Processing Toolbox, which will help you develop the advanced data visualizations. The book will then explain to you the graphic modeler, how to create QGIS plugins with PyQGIS, and how to integrate Python analysis scripts with QGIS.

By the end of the book, you will understand how to work with all aspects of QGIS and will be ready to use it for any type of GIS work.

What you will learn

  • Create and manage a spatial database
  • Get to know advanced techniques to style GIS data
  • Prepare both vector and raster data for processing
  • Add heat maps, live layer effects, and labels to your maps
  • Master LAStools and GRASS integration with the Processing Toolbox
  • Edit and repair topological data errors
  • Automate workflows with batch processing and the QGIS Graphical Modeler
  • Integrate Python scripting into your data processing workflows
  • Develop your own QGIS plugins

Who this book is for

If you are a GIS professional, a consultant, a student, or perhaps a fast learner who wants to go beyond the basics of QGIS, then this book is for you. It will prepare you to realize the full potential of QGIS.

Table of contents

  1. Title Page
  2. Copyright and Credits
    1. Mastering Geospatial Development with QGIS 3.x Third Edition
  3. About Packt
    1. Why subscribe?
    2. Packt.com
  4. Contributors
    1. About the authors
    2. About the reviewers
    3. Packt is searching for authors like you
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    4. Get in touch
      1. Reviews
  6. Section 1: Introduction
  7. A Refreshing Look at QGIS
    1. Release schedules
    2. QGIS downloading and installation
      1. Installing QGIS on Windows
      2. Installing QGIS on macOS
      3. Installing QGIS on Ubuntu Linux
        1. Installing QGIS only
        2. Installing QGIS and other FOSSGIS packages
      4. QGIS on Android
      5. Installing QGIS on a Chromebook
      6. QGIS in a browser
    3. What's new?
    4. A tour of QGIS
      1. Familiarizing yourself with QGIS Desktop
      2. Loading data into QGIS Desktop
      3. Loading vector data
      4. Loading raster data
      5. Loading databases
      6. Loading web services
    5. Working with CRS
    6. Working with tables
      1. Creating table joins
    7. Editing data
      1. Snapping
      2. Styling vector data
      3. Styling raster data
      4. Blending modes
    8. Composing maps
    9. Adding functionality with plugins
      1. Custom QGIS variables
    10. Summary
  8. Section 2: Getting Started
  9. Styling Raster and Vector Data
    1. Choosing and managing colors
      1. Knowing color picker components
      2. Changeable panels in the color picker
        1. Color ramp
        2. Color wheel
        3. Color swatches
        4. Color sampler
      3. Color picker components in the Layers panel
    2. Managing color ramps
      1. Managing the QGIS color ramp collection
        1. Renaming a color ramp
        2. Removing a color ramp
        3. Exporting a color ramp
        4. Importing a color ramp
        5. Adding a color ramp
          1. Adding a gradient color ramp
          2. Adding a random color ramp
          3. Adding a ColorBrewer color ramp
          4. Adding a cpt-city color ramp
        6. Editing a color ramp
      2. Styling singleband rasters
      3. Paletted raster band rendering 
      4. Singleband gray raster band rendering
      5. Singleband pseudocolor raster band rendering
        1. Singleband pseudocolor interpolations
    3. Styling multiband rasters
    4. Raster color rendering
    5. Raster resampling
    6. Styling vectors
      1. Single-symbol vector styling
      2. Categorized vector styling
      3. Graduated vector styling
      4. Rule-based vector styling
      5. Point-displacement vector styling
      6. Point cluster vector styling
      7. Inverted polygons vector styling
      8. Heatmap vector styling
      9. 2.5 D vector styling
    7. Vector layer rendering
      1. Layer transparency
      2. Layer blending mode
      3. Feature blending mode
      4. Control feature rendering order
    8. Using diagrams to display thematic data
      1. Parameters that are common to all diagram types
        1. Diagram size parameters
        2. Diagram placement parameters
        3. Adding attributes to diagrams
      2. Creating a pie chart diagram
      3. Creating a text diagram
      4. Creating a histogram chart diagram
    9. Saving, loading, and setting default styles
      1. Saving a style
      2. Loading a style
      3. Setting and restoring a default style
      4. Adding and renaming styles in the current QGIS project
    10. Summary
  10. Creating Spatial Databases
    1. Fundamental database concepts
      1. Describing database tables
      2. Knowing about table relationships
      3. Reviewing the basics of the structured query language
    2. Creating a spatial database
    3. Connecting to a GeoPackage
    4. Importing data into a GeoPackage
      1. Importing a vector file
      2. Importing a layer from map canvas
    5. Working with tables
      1. Creating a new table within an existing GeoPackage
      2. Renaming a table
      3. Editing an existing table field/column
      4. Deleting a GeoPackage table 
    6. Exporting tables out of a GeoPackage
    7. Creating queries and views
      1. Using select statements
      2. Creating a spatial view
      3. Dropping a spatial view
    8. Summary
  11. Preparing Vector Data for Processing
    1. Merging vectors
    2. Converting vector geometries
      1. Creating polygon centroids
      2. Converting lines into polygons
      3. Converting polygons into lines
      4. Creating polygons surrounding individual points
        1. Voronoi polygons
        2. Delaunay triangulation
      5. Extracting nodes (vertices)
      6. Simplifying and densifying features
      7. Converting between multipart and singleparts features
    3. Adding geometry columns to an attribute table
    4. Using basic vector Geoprocessing Tools
      1. Spatial overlay tools
      2. Using the Clip and Difference tools
      3. Using the Intersect and Symmetrical Difference tools
      4. Overlaying polygon layers with Union
      5. Creating buffers
      6. Generating convex hulls
      7. Dissolving features
    5. Defining coordinate reference systems
      1. Understanding the PROJ.4 definition format
      2. Defining a new custom coordinate reference system
        1. Setting Definitions
        2. Viewing a statistical summary of vector layers
    6. Advanced field calculations
      1. Exploring the field calculator interface
      2. Writing advanced field calculations
        1. Calculating and formatting current date
        2. Calculating with geometry
      3. Operators
      4. Conditions
      5. Conditionals
    7. Summary
  12. Preparing Raster Data for Processing
    1. Merging rasters
    2. About converting raster files
      1. Translating
      2. Exporting to a raster
        1. Exporting a raster to a GeoPackage
    3. Clipping a raster
    4. Converting rasters into vectors
    5. Converting from vector to raster (rasterize)
    6. Reclassifying rasters 
    7. Summary
  13. Section 3: Diving Deeper
  14. Advanced Data Creation and Editing
    1. What's new in editing?
      1. CAD-style digitizing tools
        1. Adding a circle
          1. Adding a circle from two points
          2. Adding a circle from three points
        2. Adding a rectangle
          1. Adding a rectangle from Extent
          2. Adding a rectangle from its center point
          3. Adding a rectangle from three points
        3. Adding a regular polygon
          1. Adding a regular polygon from the center and from a corner
          2. Adding a regular polygon from two points
      2. Vertex tool
    2. Creating points from coordinate data
      1. Mapping well-known text representations of geometry
    3. Geocoding address-based data
      1. How address Geocoding works
      2. The first example – Geocoding using web services
      3. The second example – Geocoding using local street network data
    4. Georeferencing imagery
      1. Understanding ground control points
      2. Using the Georeferencer GDAL plugin
      3. The first example – Georeferencing using a second dataset
        1. Getting started
        2. Entering ground control points
        3. Transformation settings
        4. Completing the operation
      4. The second example – Georeferencing using a point file
    5. Checking the topology of vector data
      1. Installing the topology checker
      2. Topological rules
        1. Rules for point features
        2. Rules for line features
        3. Rules for polygon features
      3. Using the topology checker
    6. Repairing topological errors via topological editing
      1. Example 1 – Resolving duplicate geometries
      2. Example 2 – Repairing overlaps
        1. Setting the editing parameters
    7. Repairing an overlap between polygons
    8. Example 3 – Repairing a gap between polygons
    9. Summary
  15. Advanced Data Visualization
    1. Using live layer effects
    2. Creating beautiful effects with inverted polygon shapeburst fills
      1. Creating coastal vignettes
      2. Studying area mask
    3. Using the 2.5D renderer
    4. Creating 3D views 
    5. Creating an Atlas
      1. Basic Atlas configuration
      2. Dynamic titles
      3. Dynamic legends
      4. Highlighting the coverage feature
    6. The power of geometry generators
    7. Working with the Data Plotly plugin
    8. Summary
  16. Section 4: Becoming a Master
  17. The Processing Toolbox
    1. Introducing the Processing Toolbox
    2. What's new in the Processing Toolbox?
    3. Configuring the Processing Toolbox
    4. Viewing the Processing Toolbox
      1. Running algorithms in the Processing Toolbox
    5. Using the Processing Toolbox
    6. Performing raster analysis with GRASS
      1. Calculating shaded relief
      2. Calculating least-cost path
        1. Calculating slope using r.slope
        2. Reclassifying the new slope raster and the land use raster
        3. Combining reclassified slope and land use layers
        4. Calculating the cumulative cost raster using r.cost
        5. Calculating the cost path using LCP
      3. Evaluating a viewshed
        1. Clipping elevation to the boundary of the park using GDAL
        2. Calculating viewsheds for towers using r.viewshed
        3. Combining viewsheds using r.mapcalc.simple
    7. Performing analysis using SAGA
      1. Evaluating a habitat
        1. Calculating elevation ranges using the SAGA Raster calculator
        2. Clipping land use to the park boundary using Clip grid with polygon
        3. Querying land use for only surface water using the SAGA Raster calculator
        4. Finding proximity to surface water using GDAL Proximity
        5. Querying the proximity for 1,000 meters of water using the GDAL Raster calculator
        6. Reclassifying land use using the Reclassify grid values tool
        7. Combining raster layers using the SAGA Raster calculator
    8. Exploring hydrologic analysis with SAGA
      1. Removing pits from the DEM
      2. Deriving streams
      3. Selecting the streams
      4. Delineating the streams
      5. Calculating the upstream area above Fort Klamath
    9. Summary
  18. Automating Workflows with the Graphical Modeler
    1. Introducing the graphical modeler
      1. Opening the graphical modeler
      2. Configuring the modeler and naming a model
    2. Working with your model
      1. Adding data inputs to your model
      2. Adding algorithms to your model
      3. Running a model
      4. Editing a model
      5. Documenting a model
      6. Saving, loading, and exporting models
    3. Executing model algorithms iteratively
    4. Nesting models
    5. Using batch processing with models
    6. Converting a model into a Python script
    7. Summary
  19. Creating QGIS Plugins with PyQGIS and Problem Solving
    1. Webography - where to get API information and PyQGIS help
      1. PyQGIS cookbook
      2. API documentation
      3. The QGIS community, mailing lists, and IRC channel
        1. Mailing lists
        2. IRC channel
        3. The Stack Exchange community
        4. Sharing your knowledge and reporting issues
    2. The Python Console
      1. Getting sample data
      2. My first PyQGIS code snippet
    3. My second PyQGIS code snippet - looping the layer features
    4. Exploring iface and QGis
    5. Exploring a QGIS API in the Python Console
    6. Creating a plugin structure with Plugin Builder
      1. Installing Plugin Builder
      2. Locating plugins
      3. Creating my first Python plugin - plugin_first
        1. Setting mandatory plugin parameters
        2. Setting optional plugin parameters
        3. Generating the plugin code
        4. Compiling the icon resource
        5. Plugin file structure - where and what to customize
          1. Exploring main plugin files
        6. Plugin Builder-generated files
    7. A simple plugin example
      1. Adding basic logic to TestPlugin
        1. Modifying the layout with Qt Designer
          1. Adding two pull-down menus
        2. Modifying GUI logic
        3. Modifying plugin logic
          1. Classifying layers
          2. Populating the combo box
          3. Understanding self
          4. Showing and running the dialog
          5. Some improvements
          6. More detail of the code
    8. Setting up a debugging environment
      1. What is a debugger?
      2. Installing Aptana
      3. Setting up PYTHONPATH
      4. Starting the Pydevd server
      5. Connecting QGIS to the Pydevd server
      6. Connecting using the Remote Debug QGIS plugin
    9. Debugging session example
      1. Creating a PyDev project for TestPlugin
      2. Adding breakpoints
      3. Debugging in action
    10. Summary
  20. PyQGIS Scripting
    1. Where to learn Python basics
      1. Tabs or spaces – make your choice!
    2. How to load layers
      1. How to manage rasters
        1. Exploring QgsRasterLayer
        2. Visualizing the layer
      2. Managing vector files
      3. Managing database vectors
    3. Vector structure
      1. The basic vector methods
      2. Describing the vector structure
        1. Describing the header
        2. Describing the rows
          1. Exploring QgsGeometry
    4. Iterating over features
      1. Describing iterators
    5. Editing features
      1. Updating the canvas and symbology
      2. Editing through QgsVectorDataProvider
        1. Changing a feature's geometry
          1. Changing a feature's attributes
        2. Deleting a feature
        3. Adding a feature
      3. Editing using QgsVectorLayer
        1. Discovering the QgsVectorLayerEditBuffer class
          1. Changing a feature's geometry
        2. Changing a feature's attributes
        3. Adding and removing a feature
    6. Running Processing Toolbox algorithms
      1. Listing all available algorithms
      2. Getting algorithm information
      3. Running algorithms from the console
      4. Running your own processing script
        1. Creating a test Processing Toolbox script
        2. Running the script
    7. Interacting with the map canvas
      1. Getting the map canvas
      2. Explaining Map Tools
      3. Setting the current Map Tool
      4. Getting point-click values
        1. Getting the current Map Tool
        2. Creating a new Map Tool
        3. Creating a map canvas event handler
        4. Creating a Map Tool event handler
        5. Setting up the new Map Tool
      5. Using point-click values
      6. Exploring the QgsRubberBand class
    8. Summary
  21. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product information

  • Title: Mastering Geospatial Development with QGIS 3.x - Third Edition
  • Author(s): Shammunul Islam, Simon Miles, GISP Menke, GISP Smith Jr., Luigi Pirelli, GISP Van Hoesen
  • Release date: March 2019
  • Publisher(s): Packt Publishing
  • ISBN: 9781788999892