Getting high quality data is essential for any GIS task. One great resource for free and openly licensed data is OpenStreetMap(OSM) . The OSM database consits of streets, local data as well as building polygons. Getting access to OSM data in a GIS format is integrated in QGIS. This tutorial explains the process for searching, downloading and using OSM data in QGIS.
Search for London in OSM database, browse and select a part of the city, and extract all pub locations as a shapefile.
If you do not see any data - make sure you are online - as the basemap tiles are fetched from the internet. You can also use the Pan tool to move the map canvas slightly, which will trigger a refresh of the basemap.
.osmextension is an text file in the OSM XML format. We first need to convert it into a suitable format that is easy to consume in QGIS. Go to .
Now that we do not need the OSM Place Search functionality, you can click the close button to remove it from the main window. If you need to use it again, you can enable it from(Windows) or (Linux).
london.osmas the Input XML file. Name the Output SpatiaLite DB file as
london.osm.db. Make sure the Create connection (SpatiaLite) after import button is checked.
london.osm.dbfile contains all feature types in the OSM database - Points, Lines and Polygons. GIS layers typically contain only one type of feature, so you need to choose one. Since we are interested in point locations of pubs, here you need to choose Point (nodes) as the Export type. You would choose Polylines (open ways) if you wanted to get the road network. Name the Output layer name as
london_points. GIS data has 2 parts to it - location and attributes. We are also interested in the name of the pub - not just its location, so we need to export that information as well. Click on Load from DB under Exported tags section. This will fetch all attributes from the
london.osm.dbfile. Check name and amenity tags. See OSM Tags to learn more about what each attribute means. Make sure the Load into canvas when finished is checked, and click OK.
london_pointsloaded in QGIS. Note that this contains ALL points in the OSM database for the viewport. Since we are interested only in pubs, we need to write a query to select only those. Right click on
london_pointslayer and select Open Attribute Table.
london_pointslayer and choose Save Selection As....
london_pubs.shp. Leave all other options as they are and make sure the Add saved file to map option is checked. Click OK.
london_pubsin the QGIS canvas. Uncheck the
london_pointslayer as we don’t need that anymore.
This work is licensed under a Creative Commons Attribution 4.0 International License