Skip to content

Commit

Permalink
fix(road-comparison): fix not shown bar and change color to grey
Browse files Browse the repository at this point in the history
* fix(road-comparison): fix not shown bar and change color to grey

* fix(approvaltest): edit approved file

* fix(road-comparison): fix not shown bar and change color to grey

* fix(approvaltest): edit approved file

* test: fix approved file

---------

Co-authored-by: Matthias Schaub <[email protected]>
  • Loading branch information
Gigaszi and matthiasschaub authored May 23, 2024
1 parent b30ef07 commit 06704ba
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
9 changes: 6 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

## Current Main

### New Features
### Other Changes

- add source and description to quality dimensions ([#720])
- road-comparison: change color of bar to grey ([#798])

### Bug Fixes

- road-comparison: bar for not covered roads is now shown in the plot ([#798])

[#720]: https://github.com/GIScience/ohsome-quality-api/pull/720
[#798]: https://github.com/GIScience/ohsome-quality-api/pull/798

## Release 1.3.0

Expand Down
10 changes: 7 additions & 3 deletions ohsome_quality_api/indicators/road_comparison/indicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ def create_figure(self) -> None:
x=[name],
y=[ratio * 100],
name=f"{round((ratio * 100), 1)}% of {name} are matched by OSM",
marker=dict(color="black", line=dict(color="black", width=1)),
marker=dict(
color=Color.GREY.value,
line=dict(color=Color.GREY.value, width=1),
),
width=0.4,
hovertext=f"OSM Covered: {(self.length_matched[name]/1000):.2f} km"
f" ({date:%b %d, %Y})",
Expand All @@ -187,13 +190,14 @@ def create_figure(self) -> None:
fig.add_trace(
pgo.Bar(
x=[name],
y=[1 - ratio],
y=[100 - ratio * 100],
name="{0}% of {1} are not matched by OSM".format(
round((100 - ratio * 100), 1),
name,
),
marker=dict(
color="rgba(0,0,0,0)", line=dict(color="black", width=1)
color="rgba(0,0,0,0)",
line=dict(color=Color.GREY.value, width=1),
),
width=0.4,
hovertext=f"Not OSM Covered: {length_difference_km:.2f} km "
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Microsoft Roads has a road length of 0.03 km, of which 0.03 km are covered by roads in OSM. The completeness of OSM roads in your area-of-interest is high.
Microsoft Roads has a road length of 0.03 km, of which 0.02 km are covered by roads in OSM. The completeness of OSM roads in your area-of-interest is medium.
2 changes: 1 addition & 1 deletion tests/integrationtests/indicators/test_road_comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async def side_effect_function(*args, **kwargs):
if args[1] == "oqapi.microsoft_roads_europe_2022_06_08":
return 364284, 368139
else:
return 25, 25
return 20, 25 # matched, total

async_mock = AsyncMock(side_effect=side_effect_function)
class_mocker.patch(
Expand Down

0 comments on commit 06704ba

Please sign in to comment.