{"id":1379,"date":"2014-10-30T11:19:09","date_gmt":"2014-10-30T11:19:09","guid":{"rendered":"http:\/\/all-geo.org\/volcan01010\/?p=1379"},"modified":"2014-10-31T10:53:28","modified_gmt":"2014-10-31T10:53:28","slug":"easily-plot-data-on-a-google-maps-background-with-the-qgis-openlayers-plugin","status":"publish","type":"post","link":"https:\/\/all-geo.org\/volcan01010\/2014\/10\/easily-plot-data-on-a-google-maps-background-with-the-qgis-openlayers-plugin\/","title":{"rendered":"Easily plot data on a Google Maps background with the QGIS OpenLayers plugin"},"content":{"rendered":"<p>It has never been so easy to overlay your data on a background of satellite images.\u00a0 This post explains how to do it using <a href=\"http:\/\/qgis.org\">QGIS<\/a>, which is <a href=\"https:\/\/en.wikipedia.org\/wiki\/Free_and_open-source_software\">free\/open-source software<\/a>. This gives it the huge advantage that you can download it and install it on as many computers as you want. It is very easy to use, and once you have your data into a Geographic Information System, you can then perform other analysis.<\/p>\n<p><a href=\"http:\/\/all-geo.org\/volcan01010\/wp-content\/uploads\/2014\/10\/bg_google_satellite.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-1392\" src=\"http:\/\/all-geo.org\/volcan01010\/wp-content\/uploads\/2014\/10\/bg_google_satellite.png\" alt=\"Save your image\" width=\"600\" \/><\/a><\/p>\n<h3>1 &#8211; In the field<\/h3>\n<p>This part is obvious: make a note of the location where you take a measurement\/sample! The easiest way is to use GPS and to make a new waypoint for each location. Write the coordinates in the notebook, too, as a backup.<\/p>\n<p>In this case, the data are the thickness of tephra (pumice, ash and other volcanic debris) deposited by the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Hekla#1947.E2.80.931948\">1947 eruption<\/a> of Hekla. The local wind was blowing towards the south, before swinging around to deposit volcanic ash across the <a href=\"http:\/\/onlinelibrary.wiley.com\/doi\/10.1002\/jqs.1566\/abstract\">UK and Ireland<\/a> then over to Finland.<\/p>\n<h3>2 &#8211; Preparing a CSV file<\/h3>\n<p>We are going to load the data into QGIS from a plain-text comma-separated values (csv) file. Most GPS software should be able to export waypoints in this format. The free\/open source <a href=\"http:\/\/www.gpsbabel.org\/\">GPSBabel<\/a> software can download data directly from a GPS or convert between different formats. It has a graphical user interface and command line version. An example command to extract the waypoints from a <em>.gpx<\/em> into a <em>.csv<\/em> file is below:<\/p>\n<pre><code>gpsbabel -w -i gpx -f gps_data.gpx -o csv -F measurements.csv\r\n<\/code><\/pre>\n<p>Open the <em>.csv<\/em> file in a spreadsheet or text editor and make the following changes:<\/p>\n<ul>\n<li>Add a row of column names at the top. Include as many extra columns as you need for your data (e.g. Latitude, Longitude, Waypoint, Thickness, Grainsize, SampleNo).<\/li>\n<li>Add your measurements to the data columns.<\/li>\n<\/ul>\n<p><a href=\"http:\/\/all-geo.org\/volcan01010\/wp-content\/uploads\/2014\/10\/edit_csv.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-1392\" src=\"http:\/\/all-geo.org\/volcan01010\/wp-content\/uploads\/2014\/10\/edit_csv.png\" alt=\"edit_csv\" width=\"600\" srcset=\"https:\/\/all-geo.org\/volcan01010\/wp-content\/uploads\/2014\/10\/edit_csv.png 652w, https:\/\/all-geo.org\/volcan01010\/wp-content\/uploads\/2014\/10\/edit_csv-300x191.png 300w\" sizes=\"(max-width: 652px) 100vw, 652px\" \/><\/a>Then save and close the file. If you don&#8217;t have a GPS, you can make a blank spreadsheet and type in your own coordinates by hand.<\/p>\n<h3>3 &#8211; Loading into QGIS<\/h3>\n<p><a href=\"http:\/\/all-geo.org\/volcan01010\/wp-content\/uploads\/2014\/10\/delimited_txt.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-1392\" src=\"http:\/\/all-geo.org\/volcan01010\/wp-content\/uploads\/2014\/10\/delimited_txt.png\" alt=\"Add Delimited Text Layer\" width=\"600\" \/><\/a><\/p>\n<ul>\n<li>Open QGIS and click on &#8216;Add Delimited Text Layer&#8217;, then select your file.<\/li>\n<li>If it doesn&#8217;t do it automatically, set the X and Y fields for your data.<\/li>\n<li>Press OK and your data should appear as a new layer.<\/li>\n<li>Double check that the Coordinate Reference System is correct by right-clicking your data and selecting <em>Set Layer CRS<\/em>.\n<ul>\n<li>For raw GPS data, use WGS 84 (represented by Authority ID EPSG:4326)<\/li>\n<li>UK Ordnance Survey coordinates are EPSG:27700<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><a href=\"http:\/\/all-geo.org\/volcan01010\/wp-content\/uploads\/2014\/10\/select_crs.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-1392\" src=\"http:\/\/all-geo.org\/volcan01010\/wp-content\/uploads\/2014\/10\/select_crs.png\" alt=\"Select Coordinate Reference System\" width=\"600\" \/><\/a><\/p>\n<ul>\n<li>Next, make your data prettier, using the <em>Properties <\/em>dialog (right click).\u00a0 We are going to change the symbols depending on the Thickness value and print the data alongside it.\u00a0 Features like this make using QGIS is much better than using Google Earth.<\/li>\n<\/ul>\n<p><a href=\"http:\/\/all-geo.org\/volcan01010\/wp-content\/uploads\/2014\/10\/set_style.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-1392\" src=\"http:\/\/all-geo.org\/volcan01010\/wp-content\/uploads\/2014\/10\/set_style.png\" alt=\"Set the style\" width=\"600\" \/><\/a><\/p>\n<ul>\n<li>Choose a <em>Style<\/em> for your data. I have used graduated colours based on Natural Breaks in my Thickness data.<\/li>\n<li>Use <em>Labels<\/em> to print the data values beside the points. I have selected the Thickness column and placed the text 1 mm away from the data. You could also use the Waypoint number or other data such as Sample Number.<\/li>\n<\/ul>\n<p><a href=\"http:\/\/all-geo.org\/volcan01010\/wp-content\/uploads\/2014\/10\/set_labels.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-1392\" src=\"http:\/\/all-geo.org\/volcan01010\/wp-content\/uploads\/2014\/10\/set_labels.png\" alt=\"Set the labels\" width=\"600\" \/><\/a><\/p>\n<h3>4 &#8211; Plot the background map<\/h3>\n<p><a href=\"http:\/\/all-geo.org\/volcan01010\/wp-content\/uploads\/2014\/10\/select_map_layer.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-1392\" src=\"http:\/\/all-geo.org\/volcan01010\/wp-content\/uploads\/2014\/10\/select_map_layer.png\" alt=\"Load OpenLayers background\" width=\"600\" \/><\/a><\/p>\n<ul>\n<li>Use the OpenLayers plugin (from either the Web menu or the Plugins menu, depending on your version) to choose a background map.<\/li>\n<li>Drag it to beneath your data layer in the Layers panel, then pan and zoom to get the map that you want.<\/li>\n<li>Voila! Pretty easy, eh? You can save a copy using <em>Project &gt; Save as Image&#8230;<\/em><\/li>\n<\/ul>\n<h3>5 &#8211; Other tips<\/h3>\n<ul>\n<li>Experiment with the other layers. Sometimes Bing Aerial layers are better than Google. Google and Bing may have copyright restrictions for professional use. Open Street Map is a really clean map background, Open Cycle Map has topographic features.<\/li>\n<\/ul>\n<p><a href=\"http:\/\/all-geo.org\/volcan01010\/wp-content\/uploads\/2014\/10\/combo.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-1392\" src=\"http:\/\/all-geo.org\/volcan01010\/wp-content\/uploads\/2014\/10\/combo.png\" alt=\"Experiment with other layers\" width=\"600\" \/><\/a><\/p>\n<ul>\n<li>Sometimes the OpenLayers map opens to show the whole world. In this case, right click on your data layer and select &#8216;Zoom to layer&#8217;.<\/li>\n<li>Sometimes the OpenLayers map doesn&#8217;t download all the tiles, leaving blank spaces. In this case, just pan the map a tiny bit and it should reload.<\/li>\n<li>The OpenLayers plugin only works online. To make a map available offline, turn off all layers except the OpenLayers background, then <em>Save as Image&#8230;<\/em>. Notice that as well as saving the image, a &#8216;World File&#8217; (e.g. <em>bg_googlesatellite.pngw<\/em>) is created that contains georeferencing information for the map. As long as you keep the two files together, you can load the map back in directly as a raster map with <em>Add Raster Layer&#8230;<\/em>. You will need to set the Coordinate Reference System; by default this is EPSG:3857 for OpenLayers maps.<\/li>\n<li>If you select &#8216;watch this file&#8217;, then your maps will update with changes to the data.\n<li>Use the QGIS Map Composer to make a more formal map with title, scale bar etc.<\/li>\n<\/ul>\n<h3>Further reading<\/h3>\n<ul>\n<li><a href=\"http:\/\/qgis.org\/en\/site\/forusers\/download.html\">Download \/ install QGIS<\/a><\/li>\n<\/ul>\n<p>QGIS and GPSBabel can be installed on Ubuntu-like Linux systems with a single command:<\/p>\n<pre><code>sudo apt-get install qgis gpsbabel<\/code><\/pre>\n<ul>\n<li><a href=\"http:\/\/spatialgalaxy.net\/2012\/01\/14\/qgis-plugin-of-the-week-openlayers\/\">Installation of OpenLayers plugin<\/a><\/li>\n<li>There is a checklist for collecting georeferenced field data in my <a href=\"http:\/\/all-geo.org\/volcan01010\/2014\/06\/a-robots-guide-to-fieldwork\/\">Fieldwork guide for robots (and humans)<\/a><\/li>\n<li>If your fieldwork is in Iceland during summer, or the UK during the rest of the year, my <a href=\"http:\/\/all-geo.org\/volcan01010\/2013\/08\/volcano-suit-what-to-wear-in-iceland\/\">Volcano suit \/ What to wear in Iceland<\/a> may be useful.<\/li>\n<li>The <a href=\"http:\/\/all-geo.org\/volcan01010\/2011\/07\/figures-with-imagemagick\/\">Quick, multipart, annotated figures with ImageMagick<\/a> post explains how to make combination figures like the last one.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>It has never been so easy to overlay your data on a background of satellite images.\u00a0 This post explains how to do it using QGIS, which is free\/open-source software. This gives it the huge advantage that you can download it &hellip; <a href=\"https:\/\/all-geo.org\/volcan01010\/2014\/10\/easily-plot-data-on-a-google-maps-background-with-the-qgis-openlayers-plugin\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1379","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/all-geo.org\/volcan01010\/wp-json\/wp\/v2\/posts\/1379","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/all-geo.org\/volcan01010\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/all-geo.org\/volcan01010\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/all-geo.org\/volcan01010\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/all-geo.org\/volcan01010\/wp-json\/wp\/v2\/comments?post=1379"}],"version-history":[{"count":6,"href":"https:\/\/all-geo.org\/volcan01010\/wp-json\/wp\/v2\/posts\/1379\/revisions"}],"predecessor-version":[{"id":1398,"href":"https:\/\/all-geo.org\/volcan01010\/wp-json\/wp\/v2\/posts\/1379\/revisions\/1398"}],"wp:attachment":[{"href":"https:\/\/all-geo.org\/volcan01010\/wp-json\/wp\/v2\/media?parent=1379"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/all-geo.org\/volcan01010\/wp-json\/wp\/v2\/categories?post=1379"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/all-geo.org\/volcan01010\/wp-json\/wp\/v2\/tags?post=1379"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}