QGIS Plugin of the Week: OpenLayers

January 14, 2012
By

This week we look at the OpenLayers plugin for QGIS. This plugin allows you to add a number of image services to your map canvas:

  • Google
    • Physical
    • Streets
    • Hybrid
    • Satellite
  • OpenStreetMap
  • Yahoo
    • Street
    • Hybrid
    • Satellite
  • Bing
    • Road
    • Aerial
    • Aerial with labels

Installing the Plugin

The OpenLayers plugin is installed like all other Python plugins. From the the Plugins menu in QGIS, choose Fetch Python Plugins. This brings up the plugin installer. To find the plugin, enter openlayers in the Filter box, then select OpenLayers Plugin from the list. Once it’s highlighted, click the Install plugin button. This will download the plugin from the repository, install it, and load it into QGIS.

Using the Plugin

The OpenLayers Plugin uses your view extent to fetch the data from the service you choose. For this reason you should load at least one of your own layers first. Since each of the services are expecting a request in latitude/longitude your layer either has to be geographic or you must enable on the fly projection.

To add one of the services you have two choices; you can pick the service from the Plugins->OpenLayers plugin menu or you can use the OpenLayers Overview. The Overview opens a new panel that allows you to choose a service from a drop-down list. Click the Enable map checkbox to enable the drop-down list and preview the service you want to add. If you are happy with what you see, you can add it to the map by clicking the Add map button.

In the screenshot below we have enabled the Overview panel, added the world boundaries layer1, zoomed to an area of interest, and added the Google terrain (physical) data:

You can add as many services as you want, previewing them using the OpenLayers Overview panel.

1 You can get the world boundaries layer from the Geospatial Desktop sample data set.

Tags: , , ,

13 Responses to QGIS Plugin of the Week: OpenLayers

  1. Barry Rowlingson on January 14, 2012 at 9:10 am

    Never mind plugin of the week – this is plugin of the year :)

    I’ve had problems with it in Map Composer though, and also in PDFs made from Map Composer even when it looked right in the Map Composer gui. You too? I’ll bugreport when I get a roundtuit.

  2. Vincent on January 14, 2012 at 12:27 pm

    Hi Gary,
    I think Google TOS say that a cache of google maps retrieved data is not allowed. As this plugin has to do a cache to render the data, is it really legal ? Is there some study of this case, or a specific google quote saying it’s ok to use their API like this for Quantum GIS ?

  3. Gary Sherman on January 14, 2012 at 1:16 pm

    @Vincent – I don’t think the plugin is caching the data, but rather displaying it just as a Google map on a web browser is displayed.

  4. Luca Casagrande on January 15, 2012 at 12:24 am

    Hi,
    this is coming from Google Maps API FAQ
    http://code.google.com/intl/it-IT/apis/maps/faq.html#tos_nonweb

    Bye
    Luca

  5. Vincent on January 15, 2012 at 2:01 am

    Hi,
    I had another look at GMaps TOS and chapter 10.1.3 of Google TOS ( http://code.google.com/intl/it-IT/apis/maps/terms.html#section_10_1_3 ) says :

    “(b) No Pre-Fetching, Caching, or Storage of Content. You must not pre-fetch, cache, or store any Content, except that you may store: (i) limited amounts of Content for the purpose of improving the performance of your Maps API Implementation if you do so temporarily, securely, and in a manner that does not permit use of the Content outside of the Service; and (ii) any content identifier or key that the Maps APIs Documentation specifically permits you to store. For example, you must not use the Content to create an independent database of “places.” ”

    So it seems it is OK for the QGis usage, as soon as it’s not used for fleet management or other Google TOS limitations. Great :)

    Vincent

  6. Albert Kiefer on January 15, 2012 at 7:25 am

    Hi Gary,

    Deos this work on the Mac version of Q-GIS? I cannot get it to retrieve a plug in by that name…

    Albert

  7. Gary Sherman on January 15, 2012 at 7:56 am

    @Albert: Make sure you have added the third-party repositories from the Repositories tab of the Plugin installer.

  8. Albert Kiefer on January 16, 2012 at 12:18 am

    Hi Gary,

    That’s the one I missed! Thanks.

    Albert

  9. Albert Kiefer on January 16, 2012 at 12:35 am

    Hi Gary,

    I realize that you have not written this article to receive tech support questions for plugins but I’d appreciate if you know what this message is about?

    New problem though… the overview panel now tells I need version .42 of the plugin but the plugin is version .71?

    Albert

  10. Timmie on January 16, 2012 at 1:35 am

    I noticed that if you have created data in Google Mercator (EPSG:900913), the overlay or use of these layers as background does not work.

    Using WGS84 (EPSG:4326) it works well.

  11. Gary Sherman on January 16, 2012 at 7:15 am

    @Albert: Are you using the Openlayers Overview plugin as well? You don’t need it to use the overview mentioned in this post. There is an Openlayers Overview menu item under the Openlayers plugin menu.

    For bug reports use http://hub.qgis.org/projects/openlayers/issues.

  12. Andrew Bailey on January 18, 2012 at 12:15 am

    Great plugin but why is it called Openlayers? I thought it would generate Openlayers web pages based upon current map view.

  13. Luca on January 29, 2012 at 10:18 pm

    @Andrew
    It uses OpenLayers to show the layers.

Leave a Reply

Your email address will not be published. Required fields are marked *

*