Using OpenStreetMap points of interest in QGIS

OpenStreetMap has an API called Overpass that lets you access OSM data dynamically. In this recipe, we'll add some OSM tourism points of interest to a map.

Getting ready

You will need to use the QGIS plugin manager to install the QuickOSM plugin.

You will also need to download the following shapefile and unzip it to your qgis_data/ms directory:

https://github.com/GeospatialPython/Learn/raw/master/MSCoast_geo.zip

How to do it...

We will load our base layer that defines the area of interest. Then, we'll use the Processing Toolbox to build a query for OSM, download the data, and add it to the map:

  1. First, we need to import the processing module:
            import processing 
    
  2. Next, we need to load the base layer:
     lyr = ...

Get QGIS Python Programming Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.