def testWfsSettings(self): uri = QgsDataSourceUri() QgsOwsConnection.addWfsConnectionSettings(uri, 'qgis/connections-wfs/test/') self.assertEqual(uri.param('version'), '1.1.0') self.assertEqual(uri.param('maxNumFeatures'), '47') self.assertEqual(uri.param('IgnoreAxisOrientation'), '1') self.assertEqual(uri.param('InvertAxisOrientation'), '1')
def testWfsConnection(self): c = QgsOwsConnection('WFS', 'test') uri = c.uri() self.assertEqual(uri.param('url'), 'ccc.ddd.com') self.assertEqual(uri.param('version'), '1.1.0') self.assertEqual(uri.param('maxNumFeatures'), '47') self.assertEqual(uri.param('IgnoreAxisOrientation'), '1') self.assertEqual(uri.param('InvertAxisOrientation'), '1')
def testWmsSettings(self): uri = QgsDataSourceUri() QgsOwsConnection.addWmsWcsConnectionSettings(uri, 'qgis/connections-wms/test/') self.assertEqual(uri.param('referer'), 'my_ref') self.assertEqual(uri.param('IgnoreGetMapUrl'), '1') self.assertEqual(uri.param('IgnoreGetFeatureInfoUrl'), '1') self.assertEqual(uri.param('SmoothPixmapTransform'), '1') self.assertEqual(uri.param('dpiMode'), '4') self.assertEqual(uri.param('IgnoreAxisOrientation'), '1') self.assertEqual(uri.param('InvertAxisOrientation'), '1')
def testWmsConnection(self): c = QgsOwsConnection('WMS', 'test') uri = c.uri() self.assertEqual(uri.param('url'), 'aaa.bbb.com') self.assertEqual(uri.param('referer'), 'my_ref') self.assertEqual(uri.param('IgnoreGetMapUrl'), '1') self.assertEqual(uri.param('IgnoreGetFeatureInfoUrl'), '1') self.assertEqual(uri.param('SmoothPixmapTransform'), '1') self.assertEqual(uri.param('dpiMode'), '4') self.assertEqual(uri.param('IgnoreAxisOrientation'), '1') self.assertEqual(uri.param('InvertAxisOrientation'), '1')
def testWmsSettings(self): uri = QgsDataSourceUri() QgsOwsConnection.addWmsWcsConnectionSettings( uri, 'qgis/connections-wms/test/') self.assertEqual(uri.param('referer'), 'my_ref') self.assertEqual(uri.param('IgnoreGetMapUrl'), '1') self.assertEqual(uri.param('IgnoreGetFeatureInfoUrl'), '1') self.assertEqual(uri.param('SmoothPixmapTransform'), '1') self.assertEqual(uri.param('dpiMode'), '4') self.assertEqual(uri.param('IgnoreAxisOrientation'), '1') self.assertEqual(uri.param('InvertAxisOrientation'), '1')
def wfs(self): conn = QgsOwsConnection("wfs", self.connectionCombo.currentText()) uri = conn.uri().param('url') version = conn.uri().param('version') if version == "auto": # detect version u = QUrlQuery(uri) u.addQueryItem("request", "GetCapabilities") u.addQueryItem("acceptversions", "2.0.0,1.1.0,1.0.0") xml, ns_map = xml_parse(remote_open_from_qgis(u.query())) root = xml.getroot() versions = [ v.text for v in root.findall( "./ows:ServiceIdentification/ows:ServiceTypeVersion", ns_map) ] # take the greatest version, if more than one version = sorted(versions)[-1] with qgis_proxy_settings(): return WebFeatureService(url=uri, version=version)