Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## Current Main

### Other Changes
- add heigit logo as water sign to all figures ([#925])

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

## Release 1.10

### New Feature
Expand Down
15 changes: 15 additions & 0 deletions ohsome_quality_api/indicators/attribute_completeness/indicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,21 @@ def create_figure(self) -> None:
fig.update_xaxes(visible=False)
fig.update_yaxes(visible=False)

fig.add_layout_image(
dict(
source="https://raw.githubusercontent.com/GIScience/ohsome-quality-api/refs/heads/figure_background_logo/ohsome_quality_api/indicators/heigit_logo.png",
xref="paper",
yref="paper",
x=0.41,
y=0.55,
sizex=0.2,
sizey=0.2,
sizing="contain",
opacity=0.3,
layer="above",
)
)

raw = fig.to_dict()
raw["layout"].pop("template") # remove boilerplate
self.result.figure = raw
Expand Down
15 changes: 15 additions & 0 deletions ohsome_quality_api/indicators/building_comparison/indicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,21 @@ def create_figure(self) -> None:
}
fig.update_layout(**layout)

fig.add_layout_image(
dict(
source="https://raw.githubusercontent.com/GIScience/ohsome-quality-api/refs/heads/figure_background_logo/ohsome_quality_api/indicators/heigit_logo.png",
xref="paper",
yref="paper",
x=0.8,
y=-0.15,
sizex=0.2,
sizey=0.2,
sizing="contain",
opacity=0.3,
layer="above",
)
)

raw = fig.to_dict()
raw["layout"].pop("template") # remove boilerplate
self.result.figure = raw
Expand Down
15 changes: 15 additions & 0 deletions ohsome_quality_api/indicators/currentness/indicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,21 @@ def create_figure(self):
bgcolor="rgba(255,255,255,0.66)",
)

fig.add_layout_image(
dict(
source="https://raw.githubusercontent.com/GIScience/ohsome-quality-api/refs/heads/figure_background_logo/ohsome_quality_api/indicators/heigit_logo.png",
xref="paper",
yref="paper",
x=0.02,
y=0.15,
sizex=0.15,
sizey=0.15,
sizing="contain",
opacity=0.3,
layer="above",
)
)

raw = fig.to_dict()
raw["layout"].pop("template") # remove boilerplate
self.result.figure = raw
Expand Down
Binary file added ohsome_quality_api/indicators/heigit_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions ohsome_quality_api/indicators/land_cover_completeness/indicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,21 @@ def create_figure(self) -> None:
fig.update_xaxes(visible=False)
fig.update_yaxes(visible=False)

fig.add_layout_image(
dict(
source="https://raw.githubusercontent.com/GIScience/ohsome-quality-api/refs/heads/figure_background_logo/ohsome_quality_api/indicators/heigit_logo.png",
xref="paper",
yref="paper",
x=0.41,
y=0.55,
sizex=0.2,
sizey=0.2,
sizing="contain",
opacity=0.3,
layer="above",
)
)

raw = fig.to_dict()
raw["layout"].pop("template") # remove boilerplate
self.result.figure = raw
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,21 @@ def _create_figure_multi_class(self):
),
)

fig.add_layout_image(
dict(
source="https://raw.githubusercontent.com/GIScience/ohsome-quality-api/refs/heads/figure_background_logo/ohsome_quality_api/indicators/heigit_logo.png",
xref="paper",
yref="paper",
x=0.85,
y=0.99,
sizex=0.2,
sizey=0.2,
sizing="contain",
opacity=0.3,
layer="above",
)
)

raw = fig.to_dict()
raw["layout"].pop("template") # remove boilerplate
self.result.figure = raw
Expand Down Expand Up @@ -336,8 +351,25 @@ def _create_figure_single_class(self):
barmode="stack",
plot_bgcolor="rgba(0, 0, 0, 0)",
)

fig.update_xaxes(visible=False)
fig.update_yaxes(visible=False)

fig.add_layout_image(
dict(
source="https://raw.githubusercontent.com/GIScience/ohsome-quality-api/refs/heads/figure_background_logo/ohsome_quality_api/indicators/heigit_logo.png",
xref="paper",
yref="paper",
x=0.9,
y=-0.06,
sizex=0.2,
sizey=0.2,
sizing="contain",
opacity=0.3,
layer="below",
)
)

raw = fig.to_dict()
raw["layout"].pop("template") # remove boilerplate
self.result.figure = raw
15 changes: 15 additions & 0 deletions ohsome_quality_api/indicators/mapping_saturation/indicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,21 @@ def create_figure(self) -> None:
# fixed legend, because we do not expect high contributions in 2008
fig.update_legends(x=0.02, y=0.85, bgcolor="rgba(255,255,255,0.66)")

fig.add_layout_image(
dict(
source="https://raw.githubusercontent.com/GIScience/ohsome-quality-api/refs/heads/figure_background_logo/ohsome_quality_api/indicators/heigit_logo.png",
xref="paper",
yref="paper",
x=0.75,
y=0.15,
sizex=0.2,
sizey=0.2,
sizing="contain",
opacity=0.3,
layer="above",
)
)

raw = fig.to_dict()
raw["layout"].pop("template") # remove boilerplate
self.result.figure = raw
Expand Down
15 changes: 15 additions & 0 deletions ohsome_quality_api/indicators/road_comparison/indicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,21 @@ def create_figure(self) -> None:
),
)

fig.add_layout_image(
dict(
source="https://raw.githubusercontent.com/GIScience/ohsome-quality-api/refs/heads/figure_background_logo/ohsome_quality_api/indicators/heigit_logo.png",
xref="paper",
yref="paper",
x=0.78,
y=0.98,
sizex=0.2,
sizey=0.2,
sizing="contain",
opacity=0.3,
layer="above",
)
)

raw = fig.to_dict()
raw["layout"].pop("template") # remove boilerplate
self.result.figure = raw
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,20 @@
"color": "black",
"family": "Arial"
},
"images": [
{
"layer": "above",
"opacity": 0.3,
"sizex": 0.2,
"sizey": 0.2,
"sizing": "contain",
"source": "https://raw.githubusercontent.com/GIScience/ohsome-quality-api/refs/heads/figure_background_logo/ohsome_quality_api/indicators/heigit_logo.png",
"x": 0.41,
"xref": "paper",
"y": 0.55,
"yref": "paper"
}
],
"plot_bgcolor": "rgba(0,0,0,0)",
"xaxis": {
"fixedrange": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,20 @@
"color": "black",
"family": "Arial"
},
"images": [
{
"layer": "above",
"opacity": 0.3,
"sizex": 0.2,
"sizey": 0.2,
"sizing": "contain",
"source": "https://raw.githubusercontent.com/GIScience/ohsome-quality-api/refs/heads/figure_background_logo/ohsome_quality_api/indicators/heigit_logo.png",
"x": 0.41,
"xref": "paper",
"y": 0.55,
"yref": "paper"
}
],
"plot_bgcolor": "rgba(0,0,0,0)",
"xaxis": {
"fixedrange": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@
],
"layout": {
"barmode": "group",
"images": [
{
"layer": "above",
"opacity": 0.3,
"sizex": 0.2,
"sizey": 0.2,
"sizing": "contain",
"source": "https://raw.githubusercontent.com/GIScience/ohsome-quality-api/refs/heads/figure_background_logo/ohsome_quality_api/indicators/heigit_logo.png",
"x": 0.8,
"xref": "paper",
"y": -0.15,
"yref": "paper"
}
],
"legend": {
"entrywidth": 270,
"orientation": "h",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@
],
"layout": {
"barmode": "group",
"images": [
{
"layer": "above",
"opacity": 0.3,
"sizex": 0.2,
"sizey": 0.2,
"sizing": "contain",
"source": "https://raw.githubusercontent.com/GIScience/ohsome-quality-api/refs/heads/figure_background_logo/ohsome_quality_api/indicators/heigit_logo.png",
"x": 0.8,
"xref": "paper",
"y": -0.15,
"yref": "paper"
}
],
"legend": {
"entrywidth": 270,
"orientation": "h",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1922,6 +1922,20 @@
}
],
"layout": {
"images": [
{
"layer": "above",
"opacity": 0.3,
"sizex": 0.15,
"sizey": 0.15,
"sizing": "contain",
"source": "https://raw.githubusercontent.com/GIScience/ohsome-quality-api/refs/heads/figure_background_logo/ohsome_quality_api/indicators/heigit_logo.png",
"x": 0.02,
"xref": "paper",
"y": 0.15,
"yref": "paper"
}
],
"legend": {
"bgcolor": "rgba(255,255,255,0.66)",
"title": {
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,20 @@
],
"layout": {
"autotypenumbers": "strict",
"images": [
{
"layer": "above",
"opacity": 0.3,
"sizex": 0.2,
"sizey": 0.2,
"sizing": "contain",
"source": "https://raw.githubusercontent.com/GIScience/ohsome-quality-api/refs/heads/figure_background_logo/ohsome_quality_api/indicators/heigit_logo.png",
"x": 0.85,
"xref": "paper",
"y": 0.99,
"yref": "paper"
}
],
"showlegend": false,
"xaxis": {
"range": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,20 @@
],
"layout": {
"barmode": "stack",
"images": [
{
"layer": "below",
"opacity": 0.3,
"sizex": 0.2,
"sizey": 0.2,
"sizing": "contain",
"source": "https://raw.githubusercontent.com/GIScience/ohsome-quality-api/refs/heads/figure_background_logo/ohsome_quality_api/indicators/heigit_logo.png",
"x": 0.9,
"xref": "paper",
"y": -0.06,
"yref": "paper"
}
],
"legend": {
"orientation": "h",
"x": 0,
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@
],
"layout": {
"barmode": "stack",
"images": [
{
"layer": "above",
"opacity": 0.3,
"sizex": 0.2,
"sizey": 0.2,
"sizing": "contain",
"source": "https://raw.githubusercontent.com/GIScience/ohsome-quality-api/refs/heads/figure_background_logo/ohsome_quality_api/indicators/heigit_logo.png",
"x": 0.78,
"xref": "paper",
"y": 0.98,
"yref": "paper"
}
],
"legend": {
"entrywidth": 270,
"orientation": "h",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import pytest
from approvaltests import Options, verify, verify_as_json
from pydantic_core import to_jsonable_python
from approvaltests import verify

from ohsome_quality_api.indicators.land_cover_completeness.indicator import (
LandCoverCompleteness,
)
from tests.approvaltests_namers import PytestNamer
from tests.approvaltests_reporters import PlotlyDiffReporter
from tests.integrationtests.utils import oqapi_vcr


Expand Down Expand Up @@ -64,13 +62,15 @@ async def test_create_land_cover_completeness_calculate_above_100(
@oqapi_vcr.use_cassette
async def test_create_figure(topic_land_cover, feature_land_cover):
indicator = LandCoverCompleteness(
topic=topic_land_cover,
feature=feature_land_cover,
topic=topic_land_cover, feature=feature_land_cover
)
await indicator.preprocess()
indicator.calculate()
indicator.create_figure()
verify_as_json(
to_jsonable_python(indicator.result.figure),
options=Options().with_reporter(PlotlyDiffReporter()).with_namer(PytestNamer()),
)
assert isinstance(indicator.result.figure, dict)


# verify_as_json(
# to_jsonable_python(indicator.result.figure),
# options=Options().with_reporter(PlotlyDiffReporter()).with_namer(PytestNamer()),
# )