Skip to content

Commit 30a59d4

Browse files
8.1.2
1 parent 59b184f commit 30a59d4

5 files changed

Lines changed: 16823 additions & 16801 deletions

File tree

__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def description():
3434

3535

3636
def version():
37-
return 'Version 8.1.2 - Infinity'
37+
return 'Version 8.1.3 - Infinity'
3838

3939

4040
def icon():

docs/repository.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version = '1.0' encoding = 'UTF-8'?>
22
<plugins>
3-
<pyqgis_plugin name="Semi-Automatic Classification Plugin - master" version="8.1.1" plugin_id="284">
3+
<pyqgis_plugin name="Semi-Automatic Classification Plugin - master" version="8.1.3" plugin_id="284">
44
<description><![CDATA[The Semi-Automatic Classification Plugin (SCP) allows for the supervised classification of remote sensing images, providing tools for the download, the preprocessing and postprocessing of images.]]></description>
55
<about><![CDATA[Developed by Luca Congedo, the Semi-Automatic Classification Plugin (SCP) allows for the supervised classification of remote sensing images, providing tools for the download, the preprocessing and postprocessing of images. Search and download is available for Landsat, Sentinel-2 images. Several algorithms are available for the land cover classification. This plugin requires the installation of Remotior Sensus, GDAL, OGR, Numpy, SciPy, and Matplotlib. For more information please visit https://fromgistors.blogspot.com .]]></about>
6-
<version>8.1.2</version>
6+
<version>8.1.3</version>
77
<qgis_minimum_version>3.0.0</qgis_minimum_version>
88
<qgis_maximum_version>3.99.0</qgis_maximum_version>
99
<homepage><![CDATA[https://fromgistors.blogspot.com/p/semi-automatic-classification-plugin.html]]></homepage>

interface/classification_tab.py

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,16 @@ def save_classifier_action():
150150

151151

152152
# perform classification
153-
def run_classifier(save_classifier=None, preview_point=None):
153+
def run_classifier(
154+
save_classifier=None, preview_point=None,
155+
classification_confidence=None
156+
):
154157
threshold = False
155158
signature_raster = False
156159
cross_validation = True
157160
find_best_estimator = False
158-
classification_confidence = False
161+
if classification_confidence is None:
162+
classification_confidence = False
159163
input_normalization = load_classifier = class_weight = None
160164
rf_max_features = rf_number_trees = rf_min_samples_split = svm_c = None
161165
svm_gamma = svm_kernel = mlp_hidden_layer_sizes = None
@@ -490,33 +494,47 @@ def run_classifier(save_classifier=None, preview_point=None):
490494
cfg.util_qgis.save_qml_style(
491495
raster, '%s/%s.qml' % (directory, name)
492496
)
493-
if output.extra['algorithm_raster'] is not None:
494-
# add raster to layers
495-
cfg.util_qgis.add_raster_layer(
496-
output.extra['algorithm_raster']
497-
)
498-
if output.extra['signature_rasters'] is not None:
497+
if 'algorithm_raster' in output.extra:
498+
if output.extra['algorithm_raster'] is not None:
499+
# add raster to layers
500+
cfg.util_qgis.add_raster_layer(
501+
output.extra['algorithm_raster']
502+
)
503+
if 'signature_rasters' in output.extra:
499504
# add raster to layers
500-
for s in output.extra['signature_rasters']:
501-
cfg.util_qgis.add_raster_layer(s)
505+
try:
506+
for s in output.extra['signature_rasters']:
507+
if s is not None:
508+
cfg.util_qgis.add_raster_layer(s)
509+
except Exception as err:
510+
str(err)
502511
else:
503512
cfg.mx.msg_err_1()
504513
cfg.ui_utils.remove_progress_bar(smtp=str(__name__))
505514
return output
506515

507516

508517
# create classification preview
509-
def create_preview(preview_point):
518+
def create_preview(preview_point, classification_confidence=None):
510519
point = cfg.utils.check_point_in_image(point=preview_point)
511520
if point is False:
512521
cfg.mx.msg_war_3()
513522
return False
514523
cfg.preview_point = point
515-
output = run_classifier(preview_point=point)
524+
output = run_classifier(
525+
preview_point=point,
526+
classification_confidence=classification_confidence
527+
)
516528
if output is None:
517529
return False
518530
elif output.check:
519-
output_raster = output.path
531+
if classification_confidence is None:
532+
output_raster = output.path
533+
else:
534+
if 'algorithm_raster' in output.extra:
535+
output_raster = output.extra['algorithm_raster']
536+
else:
537+
output_raster = None
520538
# move previous preview to group
521539
group = cfg.util_qgis.group_index(
522540
cfg.qgis_registry[cfg.reg_group_name]
@@ -539,7 +557,8 @@ def create_preview(preview_point):
539557
else:
540558
macroclass = False
541559
# apply symbology
542-
apply_class_symbology(cfg.classification_preview, macroclass)
560+
if classification_confidence is None:
561+
apply_class_symbology(cfg.classification_preview, macroclass)
543562
# move to top
544563
cfg.util_qgis.move_layer_to_top(cfg.classification_preview)
545564
cfg.util_qgis.set_group_visible(group, False)
@@ -567,7 +586,7 @@ def pointer_left_click(point):
567586

568587
# right click pointer
569588
def pointer_right_click(point):
570-
create_preview(point)
589+
create_preview(point, classification_confidence=True)
571590

572591

573592
# set script button

metadata.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name=Semi-Automatic Classification Plugin
33
qgisMinimumVersion=3.00
44
description=The Semi-Automatic Classification Plugin (SCP) allows for the supervised classification of remote sensing images, providing tools for the download, the preprocessing and postprocessing of images.
5-
version=8.1.2
5+
version=8.1.3
66
about=Developed by Luca Congedo, the Semi-Automatic Classification Plugin (SCP) allows for the supervised classification of remote sensing images, providing tools for the download, the preprocessing and postprocessing of images. Search and download is available for Landsat, Sentinel-2 images. Several algorithms are available for the land cover classification. This plugin requires the installation of Remotior Sensus, GDAL, OGR, Numpy, SciPy, and Matplotlib. For more information please visit https://fromgistors.blogspot.com .
77

88
author=Luca Congedo
@@ -13,6 +13,9 @@ icon=semiautomaticclassificationplugin.png
1313

1414
changelog=
1515

16+
8.1.3
17+
-fixed classification tool
18+
1619
8.1.2
1720
-fixed classification tool
1821

0 commit comments

Comments
 (0)