-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[FEATURE][needs-docs] Add XYZ connection to provide default OpenStreetMap tiles #5000
Changes from 1 commit
273243b
8486767
59aa5d3
ce01bc0
7af72f7
390a34f
dc50a3e
a82dd5b
aa4213f
e681547
858413e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
INSTALL(FILES srs.db qgis.db symbology-style.xml spatialite.db customization.xml | ||
DESTINATION ${QGIS_DATA_DIR}/resources) | ||
INSTALL(FILES qgis_global_settings.ini | ||
DESTINATION ${QGIS_DATA_DIR}) | ||
INSTALL(DIRECTORY cpt-city-qgis-min DESTINATION ${QGIS_DATA_DIR}/resources) | ||
INSTALL(DIRECTORY themes DESTINATION ${QGIS_DATA_DIR}/resources) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[qgis] | ||
connections-xyz\OpenStreetMap\authcfg= | ||
connections-xyz\OpenStreetMap\password= | ||
connections-xyz\OpenStreetMap\referer= | ||
connections-xyz\OpenStreetMap\url=http://a.tile.openstreetmap.org/{z}/{x}/{y}.png | ||
connections-xyz\OpenStreetMap\username= | ||
connections-xyz\OpenStreetMap\zmax=19 | ||
connections-xyz\OpenStreetMap\zmin=0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
*************************************************************************** | ||
test_qgis_global_settings.py | ||
--------------------- | ||
Date : January 2017 | ||
Copyright : (C) 2017, Jorge Gustavo Rocha | ||
Email : jgr at geomaster dot pt | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
*************************************************************************** | ||
""" | ||
|
||
__author__ = 'Jorge Gustavo Rocha' | ||
__date__ = 'August 2017' | ||
__copyright__ = '(C) 2017, Jorge Gustavo Rocha' | ||
# This will get replaced with a git SHA1 when you do a git archive | ||
__revision__ = '$Format:%H$' | ||
|
||
from qgis.testing import start_app, unittest | ||
from qgis.PyQt.QtCore import qDebug | ||
from qgis.core import QgsApplication, QgsRasterLayer, QgsSettings | ||
|
||
start_app() | ||
|
||
def createXYZLayerFromURL(url): | ||
typeandurl = "type=xyz&url=" + url | ||
osm = QgsRasterLayer(typeandurl, "OpenStreetMap", "wms") | ||
return osm | ||
|
||
class TestQgsGlobalSettings(unittest.TestCase): | ||
|
||
def setUp(self): | ||
"""Run before each test.""" | ||
qDebug('setUp') | ||
pass | ||
|
||
def tearDown(self): | ||
"""Run after each test.""" | ||
qDebug('tearDown') | ||
pass | ||
|
||
def test_global_settings_exist(self): | ||
qDebug('QgsApplication.pkgDataPath(): {0}'.format(QgsApplication.pkgDataPath())) | ||
# Path after deployment: QgsApplication.pkgDataPath() + '/qgis_global_settings.ini' | ||
# QgsSettings.setGlobalSettingsPath(QgsApplication.pkgDataPath() + '/resources/qgis_global_settings.ini') | ||
QgsSettings.setGlobalSettingsPath(QgsApplication.pkgDataPath() + '/qgis_global_settings.ini') | ||
self.settings = QgsSettings('testqgissettings', 'testqgissettings') | ||
settings = QgsSettings() | ||
qDebug('settings.allKeys(): {0}'.format(settings.allKeys())) | ||
defaulturl = settings.value('qgis/connections-xyz/OpenStreetMap/url') | ||
|
||
def testKey(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this function necessary? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks @elpaso There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was a WIP. Now I think it is fully implemented. |
||
self.assertEqual(defaulturl, 'http://a.tile.openstreetmap.org/{z}/{x}/{y}.png') | ||
|
||
def testLayer(): | ||
layer = createXYZLayerFromURL(defaulturl) | ||
self.assertEqual(layer.name(), 'OpenStreetMap') | ||
|
||
testKey() | ||
testLayer() | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Watch out for the indentation here