Skip to content

Commit

Permalink
fix for qgs3.22
Browse files Browse the repository at this point in the history
  • Loading branch information
warrieka committed Jan 12, 2023
1 parent 8fbcfd7 commit c4a5749
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 45 deletions.
2 changes: 1 addition & 1 deletion Makefile
@@ -1,6 +1,6 @@
# CONFIGURATION
PROFILENAME=devProfile
QGISBIN=C:\OSGeo4W\bin\qgis-bin.exe
QGISBIN=C:\OSGeo4W\bin\qgis-ltr-bin.exe
PROFILEPATH=$(APPDATA)\QGIS\QGIS3
PROFILE=$(PROFILEPATH)\profiles\${PROFILENAME}

Expand Down
5 changes: 2 additions & 3 deletions geopunt/metadataParser.py
@@ -1,5 +1,6 @@
import urllib.parse
from ..tools.web import getUrlData
import asyncio
from ..tools.web import getUrlData, fetch_non_blocking
import xml.etree.ElementTree as ET

class MDdata(object):
Expand Down Expand Up @@ -110,7 +111,6 @@ def list_suggestionKeyword(self):
def list_organisations(self):
url = self.geoNetworkUrl + '?request=GetDomain&service=CSW&version=2.0.2&PropertyName=OrganisationName'
response = getUrlData(url )

result = ET.fromstring( response )
organisations = [ n.text for n in result.findall('.//{http://www.opengis.net/cat/csw/2.0.2}Value') ]
organisations.sort()
Expand Down Expand Up @@ -141,7 +141,6 @@ def searchAll(self, q="", orgName='', dataType=''):

return searchResult


class metaError(Exception):
def __init__(self, message):
self.message = message
Expand Down
10 changes: 6 additions & 4 deletions geopunt4QgisDataCatalog.py
Expand Up @@ -166,10 +166,12 @@ def filterModel(self, col=None):
def search(self):
orgName = self.ui.organisatiesCbx.currentText()
dataTypes = [n[1] for n in self.md.dataTypes if n[0] == self.ui.typeCbx.currentText()]
if dataTypes != []: dataType = dataTypes[0]
else: dataType = None
dataType = dataTypes[0] if dataTypes != [] else None
data = self.md.searchAll( self.zoek, orgName, dataType )
self.parse_searchResults(data)

searchResult = MDdata(self.md.searchAll( self.zoek, orgName, dataType ))
def parse_searchResults(self, data):
searchResult = MDdata(data)
self.ui.countLbl.setText("Aantal gevonden: %s" % searchResult.count)
self.ui.descriptionText.setText('')
self._setModel(searchResult.records)
Expand Down Expand Up @@ -246,7 +248,7 @@ def addWFS(self):
if not accept:
return
layerName = [n[0] for n in lyrs if n[1] == layerTitle][0]
crs = next( [n[2] for n in lyrs if n[0] == layerName] , "EPSG:31370")
crs = [n[2] for n in lyrs if n[0] == layerName][0]
url = self.wfs.split('?')[0]

wfsUri = makeWFSuri(url, layerName, srsname=crs, version=version )
Expand Down
4 changes: 2 additions & 2 deletions metadata.txt
Expand Up @@ -21,8 +21,8 @@ about=NL: "Geopunt voor QGIS" is een plugin voor de QGIS open source desktop GIS
- Search for Parcels
- Search for layers in the geopunt catalog

version=2.2.9
author=Kay Warie
version=2.2.9.1
author=Kay Warrie
email=kaywarrie@gmail.com

# end of mandatory metadata
Expand Down
38 changes: 4 additions & 34 deletions testData/test.ipynb
Expand Up @@ -75,52 +75,22 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<Element '{http://www.opengis.net/wfs/2.0}FeatureType' at 0x000001B5D9B02250>,\n",
" <Element '{http://www.opengis.net/wfs/2.0}FeatureType' at 0x000001B5D9B03240>,\n",
" <Element '{http://www.opengis.net/wfs/2.0}FeatureType' at 0x000001B5D9B03E20>,\n",
" <Element '{http://www.opengis.net/wfs/2.0}FeatureType' at 0x000001B5D9B04B80>,\n",
" <Element '{http://www.opengis.net/wfs/2.0}FeatureType' at 0x000001B5D9B04FE0>,\n",
" <Element '{http://www.opengis.net/wfs/2.0}FeatureType' at 0x000001B5D9B05440>,\n",
" <Element '{http://www.opengis.net/wfs/2.0}FeatureType' at 0x000001B5D9B058A0>,\n",
" <Element '{http://www.opengis.net/wfs/2.0}FeatureType' at 0x000001B5D9B06480>,\n",
" <Element '{http://www.opengis.net/wfs/2.0}FeatureType' at 0x000001B5D9B068E0>,\n",
" <Element '{http://www.opengis.net/wfs/2.0}FeatureType' at 0x000001B5D9B06D40>,\n",
" <Element '{http://www.opengis.net/wfs/2.0}FeatureType' at 0x000001B5D9B071A0>]"
"(9, 9)"
]
},
"execution_count": 7,
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"result.findall( \".//{http://www.opengis.net/wfs/2.0}FeatureType\" )"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'2.0.1'.startswith('2.0.')"
"len( [n for n in range(100, 999+1, 100)] ) , 999 //100"
]
}
],
Expand Down
3 changes: 2 additions & 1 deletion tools/web.py
Expand Up @@ -41,7 +41,8 @@ def fetch_non_blocking(url, callback, onerror, params={}, contentType="applicati
"""
fetcher = QgsNetworkContentFetcher()
fetcher.finished.connect(
lambda: callback(fetcher.contentAsString()) if fetcher.reply().error() !=0 else onerror(fetcher.reply().errorString())
lambda: callback(fetcher.contentAsString()) if fetcher.reply().error() !=0
else onerror(fetcher.reply().errorString())
)
fullUrl = QUrl( url if len(params) == 0 else url +"?"+ urlencode(params) )
request = QNetworkRequest( fullUrl )
Expand Down

0 comments on commit c4a5749

Please sign in to comment.