Book Image

QGIS Python Programming Cookbook

Book Image

QGIS Python Programming Cookbook

Overview of this book

Table of Contents (16 chapters)
QGIS Python Programming Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using alpha values to show data density


Thematic maps often use a color ramp based on a single color to show data density. Darker colors show a higher concentration of objects, while lighter colors show lower concentrations. You can use a transparency ramp instead of a color ramp to show density as well. This technique is useful if you want to overlay the density layer on imagery or other vector layers. In this recipe, we'll be using some bear-sighting data to show the concentration of bears over an area. We'll use alpha values to show the density. We'll use an unusual hexagonal grid to divide the area and a rule-based renderer to build the display.

Getting ready

You will need to install the MMQGIS plugin, which is used to build the hexagonal grid using the QGIS Plugin Manager.

You also need to download the bear data from https://geospatialpython.googlecode.com/svn/bear-data.zip, unzip the shapefile, and put it in the ms directory of your qgis_data directory.

How to do it...

We will load the...