QGIS to Google Earth

As in the lab, we managed to get a layer out of QGIS with the styling using the mmqgis plugin (see last weeks lab section on Exporting to Google Earth).

Below is a screen shot of a quick (and ugly) map Scott made in QGIS using the graduated method of styling with the Populations values for BC.

Scott used the CD column for the naming of the output KML, but it does not really matter what column (if any) for the KML file.  In the lab however, we used the population density values calculated from population values and the area of each DA polygon.  Following this method, we were left with a map styled using graduated values with polygons missing – such as:

In order to have a map that reflects information for all the DA polygons, we need to add some data to the joined table and then apply some styling.  We will this by applying the following steps:

Styling the layer

  • Load your project in QGIS from the lab – or load the DA layer you had from the lab with the calculated population densities.
  • If you had issues with the layer load: /home/labs/geog204/tut4/pop_density_bc.shp file into your project –> then save this file to your own workspce (i.e. your geog204/tut4 folder) –> remove the layer from the lab folder
  • Style your layers using the population density field (i.e. popdense) with the graduated option with 7 classes and the quantile equal count mode

Adding some data to the empty fields to get all of our polygons in the map

  • Open the attribute table of the DA popdense layer
  • Sort the table based on the population values
  • select all the empty cells or cells marked with NULL
  • calculate the values of these selected cells (pop values for these rows) to have the value 0 by:
    • select the calculate button
    • update an existing field
    • select the population field (i.e. pop)
    • place a 0 (zero) in the expression field
    • hit OK button
    • repeat for the popdense field
    • hit the pencil to save your changes
  • You could not add more classes in your style to compensate for the newly added polygons being added to the lowest level classification

Now you can export your layer as a KML file as you did in the lab, but use “CD Name” as the name field

Once you have created a KML to from QGIS, open it in Google Earth –> File –> Open –> navigate to the file.

Navigating in Google Earth

Scott will show you the controls in Google Earth to set up your map.  Essentially you are

  • zooming into the area you are interested in (scroll on your mouse)
  • panning the map to the center of the display (drag the contents around with the mouse)
  • orienting the map to have BC tilting in a vertical position (using the navigation tools in the upper right corner)

Setting up your print output

It is fairly easy (but limited) to create a pdf for output in Google Earth.  Once you have your map oriented the way you would like start the print process by

File –> Print

The view switches to a print layout mode.  Set up your map by:

  • Map Options –> remove the legend (looks stupid no matter what)
  • Keep the other options that are turned on (do not bother with a html area)
  • Edit the title area to put in a title for you map (click on the tile area and start typing)
  • Ensure the page size is letter (Page setup) and landscape orientation
  • Set the quality at medium (little folder icon to the right of the page setup button)

You should have a map that looks something similar to Scott’s ugly map screenshot below:

Printing your map for importing into word

Printing is accomplished by:

  • hitting the save PDF button
  • Choose your tut4 directory

Converting to word is quite simple:

Newer versions of Word (and Libre office writer in the lab) will import the pdf directly into your lab assignment, but just in case we will convert it to a image file for Word or Libre Office.

  • Right click on the image in your folder using the files explorer
  • Open with –> other application
  • Scroll down to choose GIMP (GNU Image Manipulation Program)
  • Click “Import
  • File –> Exports As –> name it with the png extension (i.e lab3_ge_map.png)

You can now import the pdf or png into word for this weeks assignment.

A not so Ugly Map

A better map can be over layed in Google Earth by using the composer in QGIS. A map with labeling titles and such can be created in the composer then exported as a TIF file for use in Google Earth. Scott will illustrate

Categories: GEOG 204