Opening a shapefile using QGIS

Opening a shapefile using QGIS

Recently I’ve been looking through some open data related to my country. The thing was that some of it (mostly geographic information) was in an unknown format to me: Shapefile.

A shapefile is a data format used to store geographic information. It usually consist of at least three different types of files: a .shp (containing the geometry information), a .shx (a compiled .shp that allows programs to interpret the information more quickly) and a .dbf (a database file which stores attributes for each shape).

After a quick research I found an application called QGIS that helped me to visualize this kind of information.

QGIS is an open source application used to visualize and edit geographic information. It also provides features to analyze different kinds of information using maps as reference.

In this post I’ll explain how you can open your shapefiles using QGIS.

Installing QGIS in Mac OS X

If you haven’t downloaded QGIS yet, go to the following link.

Installing QGIS in Mac OS X can be a little bit tricky. Be sure to install the following libraries first: GDAL (http://www.kyngchaos.com/software:frameworks#gdal_complete) , MATPLOTLIB (https://github.com/matplotlib/matplotlib/downloads/).

Opening the shapefile

Once you have installed QGIS correctly follow the next steps to open your shapefiles.

1. Open QGIS.

Startup page

Depending on your QGIS version, you’ll see a page like this one.

2. Go to Layer > Add Vector Layer

Step 2

Step 2

3. Select the .shp file from your computer and press “Open”.

Result from opnening a shapefile

Result of opening a shapefile.

Displaying the shapefile over a map  (Google Map or OpenStreetMap)

All this geographic information might not make much sense if it’s not displayed over a map.

To do so, follow the next steps:

1. First, you need to install a plugin to use the map service. Go to Plugins > Manage and Install Plugins…

Install Plugin Menu

2. Look for the “OpenLayers Plugin” and press “Install Plugin”.

Search plugin

3. Once you have installed the plugin, go to Plugin > OpenLayers plugin and select your favorite map service. In this case we are using OpenStreetMap so we click on “Add OpenStreetMap layer”.

Selecting openstreetmap layer

You should now see a map, but not the shapefile you have previously imported. This is because the layer of the map is over your shapefile.

OpenStreetMap over shapefile

To fix this, go to the Layers Panel (the one in the left) and grab your shapefile to the top of the list.

Grab layer

Shapefile over map

Now you should see the shapefile over the map you chose.

 

That’s it, hope you found this information useful. If you have any question leave me a comment or check the QGIS documentation in the following link.

See you in the next post 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *