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) 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 Polygon Centroids
a. In Vector menu -> Geometry tools -> Polygon 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. Raster menu -> Interpolation
An additional location is in Manage Plug-ins. Here you add the interpolation tool.
b. In the Interpolation dialogue, select Centroids as your input.
c. Choose PerTrump or PerClinton. Add the data.
d. Under interpolation method, select Inverse distance weighting
e. Then, in the gray square in the upper right-hand corner, click it. A dialog box will pop up with the text “distance coefficient P”. This is where 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 X needs be based off of the linear unit of the projection. & Cellsize Layer properties will show what unit properties are in. Degrees or meters are examples of possible unit properties.
If your raster is not covering the entire US states, you must change the extents (x and y bounds).This changes the lat/long boundaries of the interpolation. By extending them by 1 degree for your latitudes and longitudes and it can help you cover all 48 states. Where as, before extending your degrees latitude and longitude, you might have parts of Maine or other states cut off.
Previous to new projection, it is possible that your layer is already in degrees. Then after your reporjection it is transformed into meters.
g. Create Output file name. Make sure you don't just type a name, but you give the file a source to sace to. Click the three little dots on the side to do so.
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.
Instructions updated by Sharon Dolan, March. 6, 2018