Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Printing and rotating of Javascript API based layers is currently not supported! #33

Open
borekon opened this issue May 21, 2017 · 16 comments

Comments

@borekon
Copy link

borekon commented May 21, 2017

In QGIS 2.18 for windows (i'm using windows 10, but also tried in windows 7) when adding the google maps layer there´s a banner on the top of the map window that says:

Printing and rotating of Javascript API based layers is currently not supported!

And no map is shown. Instead of the maps, there's an error message:

An error has been produced. This page has not loaded google maps correctly. Look at the javascript console for more details.

Last message appears in spanish, so the translation may not be accurate,

@samisnunu
Copy link

Same issue here, also with Bing maps:
warning:C:/Users/Sami/.qgis2/python/plugins\openlayers_plugin\openlayers_plugin.py:174: DeprecationWarning: QgsMapLayer.setLayerName() is deprecated layer.setLayerName(layerType.displayName)

I'm running Openlayers plugin v 1.4.3

@aminkian
Copy link

I do have same problem on QGIS 2.18.13 and Open Layer plugin.
I wonder if its related to my workplace network and proxy setting as I can run this plugin at my personal home pc without problem.

@t1ffi
Copy link

t1ffi commented Nov 27, 2017

I am having the same issue also with Apple Maps. Any suggestions?

@engmohamedhamed55
Copy link

???

@robertoschiano
Copy link

Same issue for me

@bhattaraianil
Copy link

same problem here. Any suggestion please.

@nilgunh
Copy link

nilgunh commented Oct 2, 2018

Any updates on this issue?

@josea1540
Copy link

I suggest you drop the OpenLayers plugin for background maps and try the Quick Map Services plugin instead.

It has more layers than OpenLayers, seems more robust, directly accesses map tiles rather than using OpenLayers' JavaScript to get them, lines up properly on Composer maps, etc.

I don't see Apple Maps in the layer list. It's quite easy to write config files for new map tile services, I did that for Stamen maps which are in the GitHub version of the plugin's addon layers.

But if all you want is one of the Google Maps layers (satellite, map, etc) then Quick Map Services does the job.

https://gis.stackexchange.com/questions/175043/google-maps-not-showing-in-qgis-2-12

let me know if it served

@basilmohammed
Copy link

Same issue reflecting for me also. I used to load map with OpenLayerand QuickMapServices. Both are showing a yellow banner with error.

screenshot 20

@lgambeta
Copy link

Is there a plugin to solve the above problem?

@pka
Copy link
Member

pka commented May 29, 2019

The OL plugin doesn't support this because it is forbidden to do it for the most important base maps. If you don't care about legal issues, then you can use the plugin mentionend before or native XYZ tiles.

@palewire
Copy link

Same bug.


QGIS version | 3.4.6-Madeira | QGIS code branch | Release 3.4
-- | -- | -- | --
Compiled against Qt | 5.5.1 | Running against Qt | 5.5.1
Compiled against GDAL/OGR | 2.2.2 | Running against GDAL/OGR | 2.2.2
Compiled against GEOS | 3.5.1-CAPI-1.9.1 | Running against GEOS | 3.5.1-CAPI-1.9.1 r4246
PostgreSQL Client Version | 9.5.17 | SpatiaLite Version | 4.3.0a
QWT Version | 6.1.2 | QScintilla2 Version | 2.9.1
PROJ.4 Version | 492


@basilmohammed
Copy link

UPDATE For My Previous Comment

There is a better way now to use a bundle of maps as base maps.

Goto QGIS and install plugin named : QuickMapServices
Find Repository Here

For first time few map servers only willl be displayed. To get more map servers follow these steps.

Web tab in QGIS > QuickMapServices > Settings > More Services (In newly opened window) > Get contributed pack.(Wait for the files are downloaded)

Now you can avail more maps servers as follows. Enjoy!
Screenshot (6)

Hope I have helped.

@hasnain-ahmad
Copy link

UPDATE For My Previous Comment

There is a better way now to use a bundle of maps as base maps.

Goto QGIS and install plugin named : QuickMapServices
Find Repository Here

For first time few map servers only willl be displayed. To get more map servers follow these steps.

Web tab in QGIS > QuickMapServices > Settings > More Services (In newly opened window) > Get contributed pack.(Wait for the files are downloaded)

Now you can avail more maps servers as follows. Enjoy!
Screenshot (6)

Hope I have helped.

Good Alternative

@pka
Copy link
Member

pka commented Sep 2, 2019

As said earlier in this thread, there are alternative ways for printing and rotating, if you don't care about legality.

@HossSayed
Copy link

There's an easy way, you don't have to install the OpenLayer Plugin.
read this article it's very helpful. https://gis.stackexchange.com/questions/20191/adding-basemaps-from-google-or-bing-in-qgis

or

open python console in QGIS: Plugins → python console, and copy this code and paste it in the console:
Author : @klas Karlsson

"""
This script should be run from the Python consol inside QGIS.

It adds online sources to the QGIS Browser.
Each source should contain a list with the folowing items (string type):
[sourcetype, title, authconfig, password, referer, url, username, zmax, zmin]

You can add or remove sources from the sources section of the code.

Script by Klas Karlsson
Sources from https://qms.nextgis.com/

Licence GPL-3

Regarding the terms of use for these background maps YOU will need to verify that you
follow the individual EULA that comes with the different services,
Most likely they will restrict how you can use the data.
"""

Sources

sources = []
sources.append(["connections-xyz","Google Maps","","","","https://mt1.google.com/vt/lyrs=m&x=%7Bx%7D&y=%7By%7D&z=%7Bz%7D","","19","0"])
sources.append(["connections-xyz","Google Satellite", "", "", "", "https://mt1.google.com/vt/lyrs=s&x=%7Bx%7D&y=%7By%7D&z=%7Bz%7D", "", "19", "0"])
sources.append(["connections-xyz","Google Terrain", "", "", "", "https://mt1.google.com/vt/lyrs=t&x=%7Bx%7D&y=%7By%7D&z=%7Bz%7D", "", "19", "0"])
sources.append(["connections-xyz","Google Terrain Hybrid", "", "", "", "https://mt1.google.com/vt/lyrs=p&x=%7Bx%7D&y=%7By%7D&z=%7Bz%7D", "", "19", "0"])
sources.append(["connections-xyz","Google Satellite Hybrid", "", "", "", "https://mt1.google.com/vt/lyrs=y&x=%7Bx%7D&y=%7By%7D&z=%7Bz%7D", "", "19", "0"])
sources.append(["connections-xyz","Stamen Terrain", "", "", "Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL", "http://tile.stamen.com/terrain/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "20", "0"])
sources.append(["connections-xyz","Stamen Toner", "", "", "Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL", "http://tile.stamen.com/toner/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "20", "0"])
sources.append(["connections-xyz","Stamen Toner Light", "", "", "Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL", "http://tile.stamen.com/toner-lite/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "20", "0"])
sources.append(["connections-xyz","Stamen Watercolor", "", "", "Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL", "http://tile.stamen.com/watercolor/%7Bz%7D/%7Bx%7D/%7By%7D.jpg", "", "18", "0"])
sources.append(["connections-xyz","Wikimedia Map", "", "", "OpenStreetMap contributors, under ODbL", "https://maps.wikimedia.org/osm-intl/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "20", "1"])
sources.append(["connections-xyz","Wikimedia Hike Bike Map", "", "", "OpenStreetMap contributors, under ODbL", "http://tiles.wmflabs.org/hikebike/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "17", "1"])
sources.append(["connections-xyz","Esri Boundaries Places", "", "", "", "https://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "20", "0"])
sources.append(["connections-xyz","Esri Gray (dark)", "", "", "", "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Base/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "16", "0"])
sources.append(["connections-xyz","Esri Gray (light)", "", "", "", "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "16", "0"])
sources.append(["connections-xyz","Esri National Geographic", "", "", "", "http://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "12", "0"])
sources.append(["connections-xyz","Esri Ocean", "", "", "", "https://services.arcgisonline.com/ArcGIS/rest/services/Ocean/World_Ocean_Base/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "10", "0"])
sources.append(["connections-xyz","Esri Satellite", "", "", "", "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "17", "0"])
sources.append(["connections-xyz","Esri Standard", "", "", "", "https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "17", "0"])
sources.append(["connections-xyz","Esri Terrain", "", "", "", "https://server.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "13", "0"])
sources.append(["connections-xyz","Esri Transportation", "", "", "", "https://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "20", "0"])
sources.append(["connections-xyz","Esri Topo World", "", "", "", "http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "20", "0"])
sources.append(["connections-xyz","OpenStreetMap Standard", "", "", "OpenStreetMap contributors, CC-BY-SA", "http://tile.openstreetmap.org/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "19", "0"])
sources.append(["connections-xyz","OpenStreetMap H.O.T.", "", "", "OpenStreetMap contributors, CC-BY-SA", "http://tile.openstreetmap.fr/hot/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "19", "0"])
sources.append(["connections-xyz","OpenStreetMap Monochrome", "", "", "OpenStreetMap contributors, CC-BY-SA", "http://tiles.wmflabs.org/bw-mapnik/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "19", "0"])
sources.append(["connections-xyz","OpenTopoMap", "", "", "Kartendaten: © OpenStreetMap-Mitwirkende, SRTM | Kartendarstellung: © OpenTopoMap (CC-BY-SA)", "https://tile.opentopomap.org/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "17", "1"])
sources.append(["connections-xyz","Strava All", "", "", "OpenStreetMap contributors, CC-BY-SA", "https://heatmap-external-b.strava.com/tiles/all/bluered/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "15", "0"])
sources.append(["connections-xyz","Strava Run", "", "", "OpenStreetMap contributors, CC-BY-SA", "https://heatmap-external-b.strava.com/tiles/run/bluered/%7Bz%7D/%7Bx%7D/%7By%7D.png?v=19", "", "15", "0"])
sources.append(["connections-xyz","Open Weather Map Temperature", "", "", "Map tiles by OpenWeatherMap, under CC BY-SA 4.0", "http://tile.openweathermap.org/map/temp_new/%7Bz%7D/%7Bx%7D/%7By%7D.png?APPID=1c3e4ef8e25596946ee1f3846b53218a", "", "19", "0"])
sources.append(["connections-xyz","Open Weather Map Clouds", "", "", "Map tiles by OpenWeatherMap, under CC BY-SA 4.0", "http://tile.openweathermap.org/map/clouds_new/%7Bz%7D/%7Bx%7D/%7By%7D.png?APPID=ef3c5137f6c31db50c4c6f1ce4e7e9dd", "", "19", "0"])
sources.append(["connections-xyz","Open Weather Map Wind Speed", "", "", "Map tiles by OpenWeatherMap, under CC BY-SA 4.0", "http://tile.openweathermap.org/map/wind_new/%7Bz%7D/%7Bx%7D/%7By%7D.png?APPID=f9d0069aa69438d52276ae25c1ee9893", "", "19", "0"])
sources.append(["connections-xyz","CartoDb Dark Matter", "", "", "Map tiles by CartoDB, under CC BY 3.0. Data by OpenStreetMap, under ODbL.", "http://basemaps.cartocdn.com/dark_all/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "20", "0"])
sources.append(["connections-xyz","CartoDb Positron", "", "", "Map tiles by CartoDB, under CC BY 3.0. Data by OpenStreetMap, under ODbL.", "http://basemaps.cartocdn.com/light_all/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "20", "0"])
sources.append(["connections-xyz","Bing VirtualEarth", "", "", "", "http://ecn.t3.tiles.virtualearth.net/tiles/a{q}.jpeg?g=1", "", "19", "1"])

Add sources to browser

for source in sources:
connectionType = source[0]
connectionName = source[1]
QSettings().setValue("qgis/%s/%s/authcfg" % (connectionType, connectionName), source[2])
QSettings().setValue("qgis/%s/%s/password" % (connectionType, connectionName), source[3])
QSettings().setValue("qgis/%s/%s/referer" % (connectionType, connectionName), source[4])
QSettings().setValue("qgis/%s/%s/url" % (connectionType, connectionName), source[5])
QSettings().setValue("qgis/%s/%s/username" % (connectionType, connectionName), source[6])
QSettings().setValue("qgis/%s/%s/zmax" % (connectionType, connectionName), source[7])
QSettings().setValue("qgis/%s/%s/zmin" % (connectionType, connectionName), source[8])

Update GUI

iface.reloadConnections()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests