Interpolation with QGIS

The interpolation process creates an image file. Image files usually need to be masked or clipped.


1)     Import both the election county and state outline shapefile, which is a vector layer, into QGIS.

2)     First, go to settings - options - processing - general - change Invalid Features Filtering to "Skip (ignore) features with invalid geometries".
Edit your state outlines to a transparent fill

a.      To do so head to layer -> Properties -> Style ->Single Symbol ->Fill

3)     Delete Alaska and Hawaii

a.      First, right click on the later and select toggle editing. The toggle butoon looks like a pencil. You can either open the atributes table to deleted the Hawaii and Alaska, or you can select them on the map.

b.     Second, select polygons you want to delete.

c.      Finally, Save edits; if needed repeat.

State and county outlines

US 48 States and counties

4)     Project the map

Once in project properties, select US Contiguous Albers Equal Area projection.

5)     Convert features to point layer using Geometry Centroids

a.      In Vector menu -> Geometry tools -> Centroids.

The interpolation will be based on points which will be the center of polygons (counties). Always set the input (this would be your election counties data) and output file (your Centroids.shp file).

6)     Interpolate based on the Election layer and Points you created.

a.      Processing Toolbox -> Interpolation -> IDW


b.     In the Interpolation dialogue, select Centroids as your input.

c.      Choose PerTrump or PerClinton. Add the data.

e.      In “distance coefficient P”, you choose the weight of the distances.

                                               If you select 2, this means that the distances are squared. Squared distances are the most common for the inverse distance squared method.

f.      Cellsize: For the extent, click the box for more options. Select same as layer - State Outlines.

g.     Create Output file name. Make sure you don't just type a name, but you give the file a source to save to. Click the three little dots on the side to do so.

                                              Ex: Interpolation1

h.     Under the Input tab hit add

                                               Make sure “type” is points


7)     Extract contours

a.      Go to Raster->Extraction->Contour

b.     Select an interval that is appropriate.

c.     This will be some fraction of your data range (i.e., max – min). Remember to create output file.

8)     Clipping masks (to dissolve your states’ geometries (this gets rid of internal boundaries)).

a.      Vector ->Geoprocessing tools ->Dissolve

b.     Then, to clip the raster: Raster>Extraction>Clip

c.     Make sure that you select mask layer, and then the masked layer is your disolved layer.

How your disolved layer will look

9)     Base the extraction on the Dissolve layer.

10)  Now clip the contour layer.










11)  Style map so that your contours, interpolation surface, and state outlines are visible.

12)  Then output a pdf to Illustrator for final design layout.

a.      Add legend, titles, etc., in Adobe Illustrator. Incorporate some innovative design elements from this page.