You are using the wrong quotes. Try '' instead of "".
E.g. if( floor("area") = 0, '',floor("area")||'m²')
Double quotes " refer to fields. In your case to the field " " (whitepsace), which most likely does not exist.
Single quotes ' refer to strings. If you want it to be just empty, there is no need to add a whitespace.
Another suggestion / alternative:
Use the expression ((-90) - @map_rotation) to account for the rotation applied to the Map canvas.
Note: the Expression Builder's Variables dropdown is a great place to look for other dynamic variables.
I will describe 2 possibilities, the first is more easy and elegant but works only from QGIS 3.10. The second also works for older versions.
Possibility 1: Use the geometry generator for labels. It is new since version 3.10 but very powerful. The expression will be
convex_hull(collect ($geometry, "id"))
this will build a convex hull around buildings with ...
The QgsPalLayerSettings class has the boolean attributes: centroidInside and centroidWhole.
So, you could add the following lines:
settings.centroidWhole = True
settings.centroidInside = True
This will calculate the centroid from the whole polygon and force the centroid positioned labels inside their corresponding polygon features.
The point of the "Around Point" placement is to allow the label engine some freedom to optimize the placement of the label within the defined radius. This can help avoid overlaps/truncations when changing scale, or when other labels are set to move around the polygon's visible extent.
In application, I've found the performance of "Around Point" to be ...
(Comments to my previous answer -- still valid -- have made clear user is most looking for ways to speed up the workflow of choosing features one by one in existing vector layers to fill in the label text field appropriately)
I'll assume your layer already has a field FID which is a unique identifier, and you've added a field LabelText that you're now ...
The formulation of your question sounds like you're assuming you need to manually go through and put in all labels that you need. The normal use case of e.g. QGIS would be to have labels entered as attributes to a (vector) layer of roads, buildings, whatnot. Then QGIS would show them automatically, with styling you specify. You could move and/or edit their ...
I think it's the if [UNIT] <> " " that cause problem. By testing for " " you are looking for a space you should try with "" (empty string) or IS NULL depending on your field type (text or numeric, if it's a text field you may want to check that the "empty" cells are consistant).
You are initializing the label with a white space, then for each s you add a new line and the s value. After the 1st s, the label is therefore white space + newline + s1
You could add the new line after the s value:
label = " "
For Each value in s
label= label & value & vbNewLine
Note that you way want to initialize with an empty char (""...
If your lines have different directions then you can use this filter:
angle_at_vertex($geometry,1) <= 180
So only one line gets labled. The one which first vertex has an angle lower than 180 degree. Note that this wont work if both lines were drawn in the same direction.