Open QGIS and add a vector layer:

Screen Shot 2014-10-01 at 2.43.13 PM

Select your shapefile – it should end in .shp

Once you’ve uploaded your shapefile, it should appear in the main area of QGIS. You probably want to start with WGS84 but it is always good to check to make sure the projection matches the original data:

First, right-click on your shapefile. Scroll down to Set Layer CRS, and select WGS84.

Your map might disappear, but fear not! You also have to set the project CRS to match the layer you just imported. Right-click on the layer again, and select “Set Project CRS from Layer”

Screen Shot 2014-10-01 at 2.44.15 PM

If you still don’t see your map, click the check-box next to your layer, go to View>Zoom to Layer. Your map should appear.

Screen Shot 2014-10-01 at 2.44.32 PM

Overlaying your map

Now that you have a base map, you can overlay your own map.

First, though, you need to georectify it. You can either input Longitude and Latitude coordinates or, if your map has features that are recognizable today, you can try to match them by hand.

Once you have georeferenced your map, it should automatically appear on the canvas, on top of the first shapefile. If it doesn’t check to make sure that all of your maps are using the same CRS.

When you’re finished, you can play with the transparency of your georectified map by double clicking and adjusting the transparency slider bar.

Adding Data

There are a few ways to overlay data on to your map: adding points, assigning information to shapefiles that someone else created, or assigning information to shapefiles you create. We’re going to walk through the first and last approaches here – for a refresher on the middle one go back to the choropleth map tutorial.

Adding Points

One way to get data on to your map is simply to upload a spreadsheet that contains some kind of non-geographic data paired with Lat/Long data.

Save as a comma separated file – the file type should be .csv

(If you’re working on a mac, sometimes the .csv files don’t upload properly. To fix the problem, save your file as “Windows Comma Separated”)

In QGIS, go to Layer>Add Delimited Text Layer and select your file.

Set X field to Longitude and Y field to Latitude. If you don’t see those options in the drop-down menu, make sure that “Number of header lines to discard” is set to 0.

Click OK, and select the appropriate CRS.

Congrats, you’ve now put data on the map!

Double click on the layer name to play around with labels, colors, etc.

Adding polygons

But, say you wanted to do more than just put some points on a map. To do that, we need to create some shapes to fill with different colors.

To do that, you need to create a new shapefile layer.

This is going to be a layer composed of polygons, so select polygon, make sure the CRS is set to WGS 84 and add whatever attributes you think are important. In this case, you could either hand enter all of the data from your csv, or create a linking category, that allows us to merge the csv data table with our shapefile. Create a mutual category and add it to the attributes list.

Create a folder and name the shapefile something like newdata.

Now we can start making some polygons.

Highlight the layer we’re going to be making. Then right-click and toggle editing.

Now click on the add feature tool.

Screen Shot 2014-10-01 at 7.03.11 PM

Use this tool to define the corners of a shape. So, for a building, click on all of the corners until the red area covers the shape you want. Then move the cursor inside the red area and right-click.

You’ll be asked to enter information. This is where we need to make sure that each building has the right code associated with it. So we would open the When you are finished making these shapes, toggle editing off.

Once you’ve created all of the shapefiles, you can merge data.

QGIS and data
Tagged on:

Leave a Reply

css.php