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

Tracking a GPS


QGIS has the ability to connect to a GPS that uses the NMEA standard. QGIS can use a serial connection to the GPS or communicate with it through the open source software called gpsd using the QGIS GPS information panel. The location information from the GPS can be displayed on the QGIS map, and QGIS can even automatically pan the map to follow the GPS point. In this recipe, we'll use the QGIS API to process NMEA sentences and update a point on a global map. The information needed to connect to different GPS units can vary widely, so we'll use an online NMEA sentence generator to get some simulated GPS information.

Getting ready

This recipe doesn't require any preparation.

How to do it...

We'll grab a batch of NMEA GPS sentences from a free online generator, create a worldwide basemap using online geojson data, create a vector point layer to represent the GPS, and finally loop through the sentences and make our track point move around the map.

To do this, we need to perform the...