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

Adding a north arrow to the map


North arrows are another common cartographic element found even in ancient maps, which show the orientation of the map relative to either true, gird, or magnetic north. Sometimes, these symbols can be quite elaborate. However, QGIS provides a basic line arrow element that we will use in combination with a map label to make a basic north arrow.

Getting ready

You will need to download the following zipped shapefile and extract it to your qgis_data directory, to a subdirectory named ms:

https://geospatialpython.googlecode.com/svn/Mississippi.zip

In addition to the shapefile, you will also need the MapComposer class to simplify the code needed to add this one element. If you haven't already used it in a previous recipe, you can download it from https://geospatialpython.googlecode.com/svn/MapComposer.py.

This file must be accessible from the QGIS Python Console; for this, you need to ensure that it is in the Python path directory. Place the file in the .qgis2/python...