7

Are there any alternatives to OpenLayers plugin to have Google / Bing maps for QGIS projects?

I need an high quality cartography (both aerial and street view) but OpenLayers plugin does not allow printing of these.

My configuration is:

  • QGIS 2.6.1
  • Windows 7 64-bit
  • OpenLayers version 1.3.5
  • Are you sure you cannot print maps with OL? I made some attempts and I have the maps. Which is the scale you want to export the maps? – matteo Jan 22 '15 at 16:50
  • I need to print 2 windows with aerial maps and street map: both at 1:7500 – Ale Jan 22 '15 at 17:02
  • not sure, but maybe it's a restriction of the providers (Google and Bing) – matteo Jan 22 '15 at 21:50
  • @matteo I do not think so because it happened also with OpenStreetMap – Ale Jan 23 '15 at 10:25
7

Just add the BaseLayer as a RasterLayer.

<GDAL_WMS>

<!-- Data is subject to term of use detailed at http://code.google.com/intl/nl/apis/maps/terms.html and
     http://www.google.com/intl/en_ALL/help/terms_maps.html -->

    <Service name="TMS">
        <!-- <ServerUrl>http://mt.google.com/vt/lyrs=m&amp;x=${x}&amp;y=${y}&amp;z=${z}</ServerUrl> --> <!-- Map -->
         <ServerUrl>http://mt.google.com/vt/lyrs=s&amp;x=${x}&amp;y=${y}&amp;z=${z}</ServerUrl> --> <!-- Satellite -->
        <!-- <ServerUrl>http://mt.google.com/vt/lyrs=y&amp;x=${x}&amp;y=${y}&amp;z=${z}</ServerUrl> --> <!-- Hybrid -->
        <!-- <ServerUrl>http://mt.google.com/vt/lyrs=t&amp;x=${x}&amp;y=${y}&amp;z=${z}</ServerUrl> --> <!-- Terrain -->
        <!-- <ServerUrl>http://mt.google.com/vt/lyrs=p&amp;x=${x}&amp;y=${y}&amp;z=${z}</ServerUrl> --> <!-- Terrain, Streets and Water  -->
    </Service>
    <DataWindow>
        <UpperLeftX>-20037508.34</UpperLeftX>
        <UpperLeftY>20037508.34</UpperLeftY>
        <LowerRightX>20037508.34</LowerRightX>
        <LowerRightY>-20037508.34</LowerRightY>
        <TileLevel>20</TileLevel>
        <TileCountX>1</TileCountX>
        <TileCountY>1</TileCountY>
        <YOrigin>top</YOrigin>
    </DataWindow>
    <Projection>EPSG:900913</Projection>
    <BlockSizeX>256</BlockSizeX>
    <BlockSizeY>256</BlockSizeY>
    <BandsCount>3</BandsCount>
    <MaxConnections>5</MaxConnections>
    <Cache />
</GDAL_WMS>

Save this part as a xml-file (or download and adapt following file: http://www.gdal.org/frmt_wms_googlemaps_tms.xml )

Then add the Layer like a normal Rasterlayer:

enter image description here

But i would doublecheck if there are any copyright restrictions: http://www.google.com/intl/en_ALL/help/terms_maps.html

(source of the xml-file: post from Timur Girgin on http://hub.qgis.org/issues/6822 )

Addition: as Answer to the question if it's also possible to load OSM this way:

<GDAL_WMS>
 <Service name="TMS">
 <ServerUrl>http://tile.openstreetmap.org/${z}/${x}/${y}.png</ServerUrl>
 </Service>
 <DataWindow>
 <UpperLeftX>-20037508.34</UpperLeftX>
 <UpperLeftY>20037508.34</UpperLeftY>
 <LowerRightX>20037508.34</LowerRightX>
 <LowerRightY>-20037508.34</LowerRightY>
 <TileLevel>18</TileLevel>
 <TileCountX>1</TileCountX>
 <TileCountY>1</TileCountY>
 <YOrigin>top</YOrigin>
 </DataWindow>
 <Projection>EPSG:3857</Projection>
 <BlockSizeX>256</BlockSizeX>
 <BlockSizeY>256</BlockSizeY>
 <BandsCount>3</BandsCount>
 <Cache />
</GDAL_WMS>

And ArcGIS:

<GDAL_WMS>
    <Service name="TMS">
        <ServerUrl>http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/${z}/${y}/${x}</ServerUrl>>
    </Service>
    <DataWindow>
        <UpperLeftX>-20037508.34</UpperLeftX>
        <UpperLeftY>20037508.34</UpperLeftY>
        <LowerRightX>20037508.34</LowerRightX>
        <LowerRightY>-20037508.34</LowerRightY>
        <TileLevel>17</TileLevel>
        <TileCountX>1</TileCountX>
        <TileCountY>1</TileCountY>
        <YOrigin>top</YOrigin>
    </DataWindow>
    <Projection>EPSG:3857</Projection>
    <BlockSizeX>256</BlockSizeX>
    <BlockSizeY>256</BlockSizeY>
    <BandsCount>3</BandsCount>
    <MaxConnections>10</MaxConnections>
    <Cache />
</GDAL_WMS>

and one more for imagery

<GDAL_WMS>
    <Service name="TMS">
        <ServerUrl>http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/${z}/${y}/${x}</ServerUrl>>
    </Service>
    <DataWindow>
        <UpperLeftX>-20037508.34</UpperLeftX>
        <UpperLeftY>20037508.34</UpperLeftY>
        <LowerRightX>20037508.34</LowerRightX>
        <LowerRightY>-20037508.34</LowerRightY>
        <TileLevel>17</TileLevel>
        <TileCountX>1</TileCountX>
        <TileCountY>1</TileCountY>
        <YOrigin>top</YOrigin>
    </DataWindow>
    <Projection>EPSG:3857</Projection>
    <BlockSizeX>256</BlockSizeX>
    <BlockSizeY>256</BlockSizeY>
    <BandsCount>3</BandsCount>
    <MaxConnections>10</MaxConnections>
    <Cache />
</GDAL_WMS>

SOURCE: http://www.gdal.org/frmt_wms.html

As mentioned above this is only the technical aspect. Concerning restrictions have a look at the Terms of use of the chosen basemap provider.

Edit1: Just answered a Question about how to use HERE Tiles in QGIS. These example you will find here: HERE background maps in QGIS possible?

| improve this answer | |
  • it works well with street cartograpy. Any idea on aerial one? (I am not so confidential with xml editing file) – Ale Jan 23 '15 at 12:15
  • 1
    just adapt the file like in my code snippet shown above. put the street-layer in comments <!-- --> and remove the comments from the areal layer so that the aerial layer is active: <ServerUrl>mt.google.com/vt/lyrs=s&amp;x=${x}&amp;y=${y}&amp;z=${z}</ServerUrl> --> <!-- Satellite --> – Thomas B Jan 23 '15 at 12:18
  • is it possible to use it also with BingMaps / OpenStreetMaps? – Ale Jan 28 '15 at 15:18
  • 1
    I just added an example for OSM. BingMaps I havent tried. perhaps someone else has done this before. – Thomas B Jan 28 '15 at 15:51
  • and one more added: esri World Imagery (inspired from ieqgis.wordpress.com/2014/08/09/… ) – Thomas B Jan 28 '15 at 17:33
5

You could as well use the TileLayerPlugin, if you provide the tile URL yourself.

For Google and Openstreetmap tiles it is:

Google  Google  http://mt.google.com/vt/lyrs=s&x={x}&y={y}&z={z}    1   0   20  -180    -85.0   180.0   85.0
Openstreetmap   OSM http://c.tile.openstreetmap.org/{z}/{x}/{y}.png 1   0   19  -180    -85.0   180.0   85.0

Note that you have to separate entries by tabs.

The print composer might request higher zoom levels than you see in the canvas. This plugin does an extra zoom on the last available, defined by the entry 19. The Openlayers Plugin does not do such extra-zoom. Hence the print output is empty even above 1:2500 for that.

Remember to respect the terms of license.


EDIT

The new QuickMapServices plugin works in a similar way, without the need to modify the configuration file.

| improve this answer | |
  • 1
    thanks, QuickMapServices worked. The 2.18.17 version of QGIS isn't loading the OpenLayers plugin for some folks. Github issue. – Nikhil VJ Sep 14 '18 at 15:33
1

You could try this: https://plugins.qgis.org/plugins/TileMapScaleLevels/

But haven't tried it lately.when I used it the layer were less blurry than the layers loaded with the ol-plugin

| improve this answer | |
  • I an not able to understand how to use it – Ale Jan 23 '15 at 10:25
  • well i just installed it now to have a look at it again and i just realised that google/bing are not available as default but I'll post another answer that works in a second – Thomas B Jan 23 '15 at 10:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.