Q:

Compute coordinates of vector line?

I have a set of vector lines (which represent translation vectors for georeferencing).
Based on the layer CRS, how can I compute the coordinates of each line in an attribute table ?
i.e (Xmax-Xmin; Ymax-Ymin) for each line.
I have managed to get the line length with $length in the expression editor but I am struggling with other geometrical parameters.
Edit: I am looking to "store the formula" within the layer. The idea is to keep these values automatically updated with the geometry. (Auto)update should happen if a new line is added or modification of the current geometry is done.

A:

You can use the Field Calculator. Open the attribute table of your line layer and select the Open Filed Calculator icon from the toolbar. I use an OSM road layer.

In the Field Calculator window create a new column of decimal type, in the Geometry group of functions you can find x_min, x_max, y_min, y_max functions. To create a column with x_range of features use the next screenshot:

You can create a column for y_range in a similar way.

A:

For QGIS 3.x, the formula in the field calculator is :
'(' || x_max($geometry) || '-' || x_min($geometry) || '; ' || y_max($geometry) || '-' || y_min($geometry) || ')'

A:

Following J.Monticolo's answer, yet another expression is:
'(' || bounds_width($geometry) || '; ' || bounds_height($geometry) ||')'

