Tuesday 10 January 2017

qgis - How to define map extents based on a feature's geometry?


There is a polygon geometry in my QGIS project which represents the extents of my map. Does anybody know how to use the data defined override to get the X/Y min and X/Y max coordinates of the polygon in the print composer?


enter image description here


Unfortunately this isn't working:


xmin(attribute(getFeature('layername', 'gid', 1), 'geom'))

Answer



The geometry can be accessed directly rather than through the attributes:


x_min(geometry(getFeature('airports', 'cat', 1)))

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...