Skip to content

Commit

Permalink
Specifying gpkg aoi layer name when plotting aoi border with Qgis
Browse files Browse the repository at this point in the history
  • Loading branch information
ghislainv committed Jun 16, 2024
1 parent 2d5bcc6 commit 3e38cfc
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 21 deletions.
2 changes: 1 addition & 1 deletion deforisk_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ def catch_arguments(self):
"""Catch arguments from UI."""
# Get variables
workdir = self.dlg.workdir.filePath()
aoi = self.dlg.aoi.text()
aoi = self.dlg.aoi.filePath()
years = self.dlg.years.text()
fcc_source = self.dlg.fcc_source.text()
perc = int(self.dlg.perc.text())
Expand Down
17 changes: 7 additions & 10 deletions deforisk_plugin_dialog_base.ui
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,6 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="aoi">
<property name="text">
<string>MTQ</string>
</property>
<property name="placeholderText">
<string>MTQ</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_tile_size">
<property name="text">
Expand Down Expand Up @@ -250,6 +240,13 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QgsFileWidget" name="aoi">
<property name="dialogTitle">
<string>Select gpkg file with &quot;aoi&quot; and &quot;subj&quot; layers</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QLabel" name="logo">
Expand Down
4 changes: 2 additions & 2 deletions far_functions/far_get_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,8 @@ def finished(self, result):
var_group = root.addGroup("Variables")

# Add border layer to QGis project
border_file = opj(self.DATA, "aoi_proj.gpkg")
border_layer = QgsVectorLayer(border_file, "border", "ogr")
border_file = opj(self.DATA, "aoi_proj.gpkg|layername=aoi")
border_layer = QgsVectorLayer(border_file, "aoi border", "ogr")
border_layer.loadNamedStyle(opj("qgis_layer_style", "border.qml"))
add_layer(far_project, border_layer)

Expand Down
4 changes: 2 additions & 2 deletions far_functions/far_predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ def finished(self, result):
predict_group = root.addGroup("FAR models")

# Add border layer to QGis project
border_file = opj(self.DATA, "aoi_proj.gpkg")
border_layer = QgsVectorLayer(border_file, "border", "ogr")
border_file = opj(self.DATA, "aoi_proj.gpkg|layername=aoi")
border_layer = QgsVectorLayer(border_file, "aoi border", "ogr")
border_layer.loadNamedStyle(opj("qgis_layer_style", "border.qml"))
add_layer(far_project, border_layer)

Expand Down
4 changes: 2 additions & 2 deletions rmj_functions/bm_calibrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,9 @@ def finished(self, result):
mw_group = root.addGroup("Benchmark")

# Add border layer to QGis project
border_file = opj(self.DATA, "aoi_proj.gpkg")
border_file = opj(self.DATA, "aoi_proj.gpkg|layername=aoi")
border_layer = QgsVectorLayer(
border_file, "border", "ogr")
border_file, "aoi border", "ogr")
border_layer.loadNamedStyle(
opj("qgis_layer_style", "border.qml"))
add_layer(far_project, border_layer)
Expand Down
4 changes: 2 additions & 2 deletions rmj_functions/bm_predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ def finished(self, result):
mw_group = root.addGroup("Benchmark")

# Add border layer to QGis project
border_file = opj(self.DATA, "aoi_proj.gpkg")
border_layer = QgsVectorLayer(border_file, "border", "ogr")
border_file = opj(self.DATA, "aoi_proj.gpkg|layername=aoi")
border_layer = QgsVectorLayer(border_file, "aoi border", "ogr")
border_layer.loadNamedStyle(opj("qgis_layer_style", "border.qml"))
add_layer(far_project, border_layer)

Expand Down
4 changes: 2 additions & 2 deletions rmj_functions/mw_predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ def finished(self, result):
mw_group = root.addGroup("Moving window")

# Add border layer to QGis project
border_file = opj(self.DATA, "aoi_proj.gpkg")
border_layer = QgsVectorLayer(border_file, "border", "ogr")
border_file = opj(self.DATA, "aoi_proj.gpkg|layername=aoi")
border_layer = QgsVectorLayer(border_file, "aoi border", "ogr")
border_layer.loadNamedStyle(opj("qgis_layer_style", "border.qml"))
add_layer(far_project, border_layer)

Expand Down

0 comments on commit 3e38cfc

Please sign in to comment.