Skip to content

Commit

Permalink
[Fixes #11349] Keep into account maplayers visibility and order when … (
Browse files Browse the repository at this point in the history
#11443)

* [Fixes #11349] Keep into account maplayers visibility and order when generating map thumbnails

* [Fixes #11349] Fix black format

* [Fixes #11349] Fix test

* [Fixes #11349] remove typo

---------

Co-authored-by: Giovanni Allegri <[email protected]>
  • Loading branch information
mattiagiupponi and giohappy authored Sep 13, 2023
1 parent e3cd45e commit 4b49d62
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions geonode/thumbs/tests/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ def test_datasets_locations_simple_map(self):
[
[
settings.OGC_SERVER["default"]["LOCATION"],
["geonode:Meteorite_Landings_from_NASA_Open_Data_Portal1", dataset.alternate],
["test_style", "theaters_nyc"],
[dataset.alternate, "geonode:Meteorite_Landings_from_NASA_Open_Data_Portal1"],
["theaters_nyc", "test_style"],
]
],
)
Expand All @@ -255,9 +255,9 @@ def test_datasets_locations_composition_map_default_bbox(self):
[
settings.GEOSERVER_LOCATION,
[
"rt_geologia.dbg_risorse_minerarie",
"geonode:Meteorite_Landings_from_NASA_Open_Data_Portal1",
"geonode:theaters_nyc",
"geonode:Meteorite_Landings_from_NASA_Open_Data_Portal1",
"rt_geologia.dbg_risorse_minerarie",
],
[],
]
Expand Down
2 changes: 1 addition & 1 deletion geonode/thumbs/thumbnails.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def _datasets_locations(
else:
bbox = utils.transform_bbox(instance.bbox, target_crs)
elif isinstance(instance, Map):
for map_dataset in instance.maplayers.iterator():
for map_dataset in instance.maplayers.filter(visibility=True).order_by("order").iterator():
if not map_dataset.local and not map_dataset.ows_url:
logger.warning(
"Incorrectly defined remote dataset encountered (no OWS URL defined)."
Expand Down

0 comments on commit 4b49d62

Please sign in to comment.