-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add new report MultilevelMappingSaturation
- Loading branch information
1 parent
1212d18
commit 2700077
Showing
6 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
14 changes: 14 additions & 0 deletions
14
workers/ohsome_quality_analyst/reports/multilevel_mapping_saturation/metadata.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
MultilevelMappingSaturation: | ||
name: Multilevel Mapping Saturation | ||
description: | | ||
This report shows the mapping saturation of four major Map Features (https://wiki.openstreetmap.org/wiki/Map_features): buildings, land-use/land-cover, points of interest and infrastructure. | ||
It evolved from the OSM Element Vectorisation tool (https://gitlab.gistools.geog.uni-heidelberg.de/giscience/ideal-vgi/osm-element-vectorisation). | ||
label_description: | ||
red: | | ||
The general mapping saturation for central elements in this region is low indicating a very early stage of the data. | ||
yellow: | | ||
The area experiences a considerable amount of mapping but is still growing. | ||
green: | | ||
This area is either well mapped or otherwise stale. | ||
undefined: | | ||
The quality level could not be calculated, possibly due to no convergence in the model. |
19 changes: 19 additions & 0 deletions
19
workers/ohsome_quality_analyst/reports/multilevel_mapping_saturation/report.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from ohsome_quality_analyst.base.report import BaseReport, IndicatorLayer | ||
from ohsome_quality_analyst.utils.definitions import get_attribution | ||
|
||
|
||
class MultilevelMappingSaturation(BaseReport): | ||
def set_indicator_layer(self): | ||
self.indicator_layer = ( | ||
IndicatorLayer("MappingSaturation", "ideal_vgi_infrastructure"), | ||
IndicatorLayer("MappingSaturation", "poi"), | ||
IndicatorLayer("MappingSaturation", "lulc"), | ||
IndicatorLayer("MappingSaturation", "building_count"), | ||
) | ||
|
||
def combine_indicators(self) -> None: | ||
super().combine_indicators() | ||
|
||
@classmethod | ||
def attribution(cls) -> str: | ||
return get_attribution(["OSM"]) |
37 changes: 37 additions & 0 deletions
37
workers/tests/unittests/test_multilevel_mapping_saturation.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import unittest | ||
from unittest.mock import Mock | ||
|
||
from ohsome_quality_analyst.reports.multilevel_mapping_saturation.report import ( | ||
MultilevelMappingSaturation, | ||
) | ||
|
||
from .utils import get_geojson_fixture | ||
|
||
|
||
class TestReportMultilevelMappingSaturation(unittest.TestCase): | ||
# TODO: Test case for indicator.result undefined | ||
def test_combine_indicators_mean(self): | ||
|
||
geometry = get_geojson_fixture("heidelberg-altstadt-geometry.geojson") | ||
report = MultilevelMappingSaturation(geometry) | ||
report.set_indicator_layer() | ||
|
||
# Mock indicator objects with a fixed result value | ||
for _ in report.indicator_layer: | ||
indicator = Mock() | ||
indicator.result = Mock() | ||
indicator.result.value = 0.5 | ||
indicator.result.html = "foo" | ||
report.indicators.append(indicator) | ||
|
||
report.combine_indicators() | ||
report.create_html() | ||
|
||
self.assertIsNotNone(report.result.label) | ||
self.assertIsNotNone(report.result.description) | ||
self.assertIsNotNone(report.result.html) | ||
self.assertEqual(report.result.value, 0.5) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |