Skip to content

Commit

Permalink
[Fix #12589] Update bbox command for maps (#12590)
Browse files Browse the repository at this point in the history
* Update bbox command for maps
  • Loading branch information
kikislater authored Sep 23, 2024
1 parent 3973941 commit 684227f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions geonode/geoserver/management/commands/sync_geonode_maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ def sync_geonode_maps(ignore_errors,
filter,
username,
removeduplicates,
updatethumbnails):
updatethumbnails,
updatebbox,
):
maps = Map.objects.all().order_by('title')
if filter:
maps = maps.filter(title__icontains=filter)
Expand All @@ -52,6 +54,9 @@ def sync_geonode_maps(ignore_errors,
# remove duplicates
print("Removing duplicate links...")
remove_duplicate_links(map)
if updatebbox:
print("Regenerating BBOX...")
map.compute_bbox()
except (Exception, RuntimeError):
map_errors.append(map.title)
exception_type, error, traceback = sys.exc_info()
Expand Down Expand Up @@ -106,11 +111,15 @@ def add_arguments(self, parser):
dest="updatethumbnails",
default=False,
help="Update the map styles and thumbnails.")
parser.add_argument(
"--updatebbox", action="store_true", dest="updatebbox", default=False, help="Update the map BBOX."
)

def handle(self, **options):
ignore_errors = options.get('ignore_errors')
removeduplicates = options.get('removeduplicates')
updatethumbnails = options.get('updatethumbnails')
updatebbox = options.get("updatebbox")
filter = options.get('filter')
if not options.get('username'):
username = None
Expand All @@ -121,4 +130,6 @@ def handle(self, **options):
filter,
username,
removeduplicates,
updatethumbnails)
updatethumbnails,
updatebbox,
)

0 comments on commit 684227f

Please sign in to comment.