diff --git a/get_nib.py b/get_nib.py index 3b5aa22da5738d243b5487e095f02fd0822b4a71..88005ea77388e8ac64020a583516005932086dcd 100644 --- a/get_nib.py +++ b/get_nib.py @@ -430,6 +430,10 @@ class getnib: """ If this should not be the default, remove comment # from next line """ # self.dlg.checkBox_resetNib.setChecked(False) # Unchecked + # As default: Set orthophoto-projects checkbox checked + """ If this should not be the default, remove comment # from next line """ + self.dlg.checkBox_resetNib.setChecked(True) # Unchecked + # As default: Set map canvas checkbox to checked """ If this should not be the default, comment # next line """ self.dlg.radioButton_ucmcbb.setChecked(True) # Checked @@ -510,10 +514,22 @@ class getnib: """" Additional code""" selectedLayer = '' # Initialize reset = False + of = False + sat = False + ir = False if self.dlg.checkBox_resetNib.isChecked(): # Empty the Nib-prosjekt group reset = True + if self.dlg.checkBox_of_proj.isChecked(): # Orthphoto-projects is checked + of = True + + if self.dlg.checkBox_sat_proj.isChecked(): # Satellite-projects is checked + sat = True + + if self.dlg.checkBox_ir_proj.isChecked(): # Infrared-projects is checked + ir = True + # If checked, use current map canvas as bounding box (= extent of) if self.dlg.radioButton_ucmcbb.isChecked(): # Get the extent of current map canvas (coordinates in the project's crs) @@ -553,7 +569,7 @@ class getnib: else: # If no file or layer is selcted, throw an error mesage and end plugin self.iface.messageBar().pushMessage("Error", "No layer selected!", level=Qgis.Critical, duration=3) return # Return from (end) plugin - + elif self.dlg.radioButton_file.isChecked(): # File-option checked fname = self.dlg.lineEdit_file.text() # Get the text (path and filename) if fname != "": @@ -642,7 +658,21 @@ class getnib: # Load Norge i bilder-project based on the bounding box (geojson-format x1,y1;x2,y2;x3,y3;...) # https://norgeibilder.no/dok/webtjenester.pdf # 1 = Ortofoto 10, 2 = Ortofoto 20, 3 = Ortofoto 50, 4 = Ortofoto N50, 5 = Ortofoto Skog, 6 = Satellittbilde, 7 = Infrarødt, 8 = Rektifiserte flybilder, 9 = Ortofoto - para=parse.quote('{Filter:"ortofototype in (1,2,3,4,5,6,7,8,9)",Coordinates:"'+coords+'",InputWKID:'+str(crs_proj_int)+',StopOnCover:false}') + if of and not sat and not ir: + param ='{Filter:"ortofototype in (1,2,3,4,5,8,9)",Coordinates:"'+coords+'",InputWKID:'+str(crs_proj_int)+',StopOnCover:false}' + if of and sat and not ir: + param = '{Filter:"ortofototype in (1,2,3,4,5,6,8,9)",Coordinates:"'+coords+'",InputWKID:'+str(crs_proj_int)+',StopOnCover:false}' + if of and sat and ir: + param = '{Filter:"ortofototype in (1,2,3,4,5,6,7,8,9)",Coordinates:"'+coords+'",InputWKID:'+str(crs_proj_int)+',StopOnCover:false}' + if sat and not of and not ir: + param = '{Filter:"ortofototype in (6)",Coordinates:"'+coords+'",InputWKID:'+str(crs_proj_int)+',StopOnCover:false}' + if sat and ir and not of: + param ='{Filter:"ortofototype in (6,7)",Coordinates:"'+coords+'",InputWKID:'+str(crs_proj_int)+',StopOnCover:false}' + if ir and not sat and not of: + param ='{Filter:"ortofototype in (7)",Coordinates:"'+coords+'",InputWKID:'+str(crs_proj_int)+',StopOnCover:false}' + + # para=parse.quote('{Filter:"ortofototype in (1,2,3,4,5,6,7,8,9)",Coordinates:"'+coords+'",InputWKID:'+str(crs_proj_int)+',StopOnCover:false}') + para=parse.quote(param) js = requests.get('https://tjenester.norgeibilder.no/rest/projectMetadata.ashx?request='+para).json() #list with current of-project on json-format nib_liste = js['ProjectList'] # Debugging