Skip to content

Commit 7efd81f

Browse files
committed
Added buffer when exporting plan to PDF, added print layout to project.
Added 10% buffer to plan feature when exporting to PDF, added print layout to project.
1 parent f3ee403 commit 7efd81f

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

arho_feature_template/core/plan_manager.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -454,8 +454,15 @@ def create_geotiff(self):
454454
iface.messageBar().pushWarning("", "Tulostusasettelussa ei ole karttaobjektia.")
455455
return
456456

457-
# Set the map item's extent to the feature's bounding box
458-
map_item.zoomToExtent(feature.geometry().boundingBox())
457+
# Expand the bounding box by 10%
458+
bbox = feature.geometry().boundingBox()
459+
buffer_percentage = 0.1
460+
buffer_x = bbox.width() * buffer_percentage
461+
buffer_y = bbox.height() * buffer_percentage
462+
buffered_bbox = bbox.buffered(max(buffer_x, buffer_y))
463+
464+
map_item.zoomToExtent(buffered_bbox)
465+
layout.refresh()
459466

460467
# Refresh the layout
461468
layout.refresh()

qgisprojekti.qgz

938 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)