4

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: ...


3

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.


3

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 ...


3

The QgsPalLayerSettings class has the boolean attributes: centroidInside and centroidWhole. See docs 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.


2

project = QgsProject.instance() projectLayoutManager = project.layoutManager() layout = projectLayoutManager.layoutByName("Name of your layout") map = layout.itemById("map") map.scale()


2

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 ...


1

(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 ...


1

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 ...


1

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).


1

SLD is an XML based language so newlines are just another type of whitespace. If you need a new line you need to wrap in a cdata block.


1

Solution: Function FindLabel ( [ID_Messpkt], [Pb_corr] ) FindLabel = [ID_Messpkt]& vbNewLine &[Pb_corr] if ([Pb_corr] = 49) then FindLabel = "<50" end if End Function


1

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 Next Note that you way want to initialize with an empty char (""...


1

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.


1

To hide the labels outside feature - change to 'rule based labelling' and insert within($geometry, @atlas_geometry )=1 as filter


Only top voted, non community-wiki answers of a minimum length are eligible