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

Collecting field data


For decades, collecting field observation data from the field into a GIS required hours of manual data entry or, at best, loading data after the trip. Smartphones and laptops with cellular connections have revolutionzed this process. In this recipe, we'll use a simple but interesting geojson-based framework to enter information and a map location from any Internet-connected device with a web browser and update a map in QGIS.

Getting ready

There is no preparation required for this recipe.

How to do it...

We will load a world boundaries layer and the field data layer onto a QGIS map, go to the field data mobile website and create an entry, and then refresh the QGIS map to see the update. To do this, we need to perform the following steps:

  1. In the QGIS Python Console, add the following geojson layers:

    wb = "https://raw.githubusercontent.com/johan/\ world.geo.json/master/countries.geo.json"
    basemap = QgsVectorLayer(wb, "Countries", "ogr")
    observations = \
    QgsVectorLayer("http...