Searching and Downloading OpenStreetMap Data

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 consist 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 OSM database, browse and select a part of the Area of interest, and extract data as a shapefile.

Procedure

Make sure you have installed OpenLayers plugins.

The OpenLayers plugin is installed under the Web menu. This plugin allows you to access basemaps from various providers in QGIS.
  • Let’s load the OpenStreetMap basemap in QGIS by going to Web Menu ‣ OpenLayers plugin ‣ OpenStreetMap ‣ OpenStreetMap layer.


1


You will see a world map loaded in QGIS.


2


  • Now, let’s search for your Interested area, I will search kalian West area.
You will see the base layer move and center around the Area of Interested. You can use the Zoom tool to zoom and select the exact area of your interest. For this tutorial, you can zoom in the center of the city as shown.


3
  • Now we can download the data displayed on the map canvas. Go to Vector ‣ OpenStreetMap ‣ Download data.


4
  • In the Download OpenStreetMap data dialog, choose From map canvas as the Extent. Choose the path and name the output file as Kalyan.osm and Click OK.


5
  • The downloaded file with the .osm extension 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 Vector ‣ OpenStreetMap ‣ Import topology from XML.


6
  • Choose the downloaded Kalyan.osm as the Input XML file. Name the Output SpatiaLite DB file as Kalyan.osm.db. Make sure the Create connection (SpatiaLite) after import button is checked. Click OK.


7


  • We need to create SpatialLite geometry layers that can be viewed and analyzed in QGIS. This is done using Vector ‣ OpenStreetMap ‣ Export topology to SpatialLite.
8


  • The Kalyan.osm.db file 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 building, here you need to choose Polygon (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 Kalyan_building. GIS data has 2 parts to it - location and attributes. We are also interested in the name of the buildings - 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 Kalyan.osm.db file. Check name and building 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.


9


  • You will see a new Polygon layer named Kalyan_buildings loaded in QGIS. Note that this contains ALL polygon in the OSM database for the viewport.


10


  • To view attribute Right click on Kalyan_buildings layer and select Open Attribute Table.

11
  • To save as vector layer. Right-click the Kalyan_buildings layer and choose     Save As....
  • In the Save vector layer as... dialog, enter the name of the output file as Kalyan_buildings.shp. Leave all other options as they are and make sure the Add saved file to map option is checked. Click OK.


12
  • You will see a new layer named Kalyan_buildings.shp in the QGIS canvas. Uncheck the Kalyan_buildings layer as we don’t need that anymore.


13


The extraction of the Kalyan_buildings shapefile layer is now complete.

Comments

Popular Posts