Status bar in QGIS can display min/max of x/y for extents of the map view when panning and zooming. How can these values be extracted and used in expressions? The manual’s expression page doesn’t seem to have variables for current map view extents.
Do you mean the extent of the canvas (the view in the main window)?
This can be accessed using the
@map_extent variable in Expression Builder which returns a polygon of the current canvas map extent.
You can then use
min_y() etc. to extract bounding box coordinates for use in your labels, or to guide your label placement using data defined override.
See below for an example of labels that update based on the map canvas extent. The expression uses
min_y(@map_extent) and then the distance from the point
$geometry to the SW corner of the canvas (
make_point() of the min_x/min_y values).