New answers tagged

3

As you added more details, it seems that you're looking for something else: To set a label only for the features in layer polygon that intersect with layer selection, open the label settings for layer polygon. Got to the Rendering tab and next to Show label use data driven override and paste this expression (available since QGIS 3.16): overlay_intersects( '...


6

array_length(overlay_intersects('Parcels',$id)) should do what you are looking for. Edit: Seeing Babel's answer I am not quite sure if I understand your question correctly, this expression counts the number of intersecting features from the layer 'Parcels'


5

Use this expression to label your Projet layer with a comma-delimited string of attribute values. Replace attribute with the name of the field from where the values should come from: array_to_string (overlay_intersects ('Parcels with numbers', attribute))


1

I am working in arcpy for ArcGIS Pro, in a similar situation, and I wanted to say that Try inserting this code: layer.showLabels = True from Get Spatial, above, worked for enabling my layer to support labeling. Here's what I am using as a test lyr.showLabels = True if lyr.supports("SHOWLABELS"): if lyr.showLabels: ...


9

A different aproach (than @Babel's) is to use the geometry generator which is available also in the label-engine. Just collect the geometries with the same name, building a multipoint geometry and then using the boundingbox to label all points with the same name with one Label: The expression is (where "name" is the id for same objects which ...


3

In the label settings, go to the last tab called rendering and next to show label select data driven override and select edit (see screenshot below). Paste the following expression (overlay_nearest() function is available since QGIS 3.16, array_min() since QGIS 3.18). It returns true (=show label) only if the point has a certain minimum distance (change ...


1

In your project at QGIS Desktop, you must open the Layer Properties and in Display change you Display Name. It can be an Expression based on 2 or more fields


3

Yes this is possible. To do this you need to set labelling to rule based labelling. One rule will be for your top line and the second rule for the bottom line. You don't to set any filters for the rules but you can set them to display different fields and have different label symbologies. There may just be a little bit more effort involved in getting the ...


1

Not an answer, but, on 3.18, I see much the same thing. With some labels, I can just see the underlying map through the buffer when multiplying. On others, I can see them on one side of the label buffer, but not the other. But the Blend Mode seems to be almost ignored. Turning off the mask gives results like yours (with a big buffer and soft light). So, no ...


3

You could use if(array_agg($id,group_by:="ELEV")[0] = $id,"ELEV",'') as label value. But keep in mind this costs some calcuation and may slow down rendering especially on large layers. How it works: the expression generates an array of each feature-id, grouping the ones together having the same elevation. Now it checks for each feature ...


3

You can make the font size constant in metres rather than points, so it will scale with the map. In Layer Styling, select Metres at Scale instead of Points. You can also make the size in points (or metres) a function of polygon area, using an expression. The polygons below are 10000 square km on the outside, and smaller in the middle of the map. The ...


2

While @Hornbydd's answer directly addresses your question, I wanted to point out that another approach to solving this would be to use Label Classes, which are the built-in solution for accomplishing exactly what what you are trying to do: label different features different ways depending on a specific set of criteria. A very very basic primer on label ...


2

You are mixing languages (VB and python), that's why your code is not working. Make sure the parser is set to PYTHON and here is an example of either printing the label in upper case or in italics: def FindLabel ( [TYPE] , [LABEL] ): if [TYPE] == "School": return [LABEL].upper() else: return "<ITA> " + [LABEL] + "&...


2

Below is the code required to alter the Halo of a Text Symbol. I have to say it's not particularly clear from the help file how to do it and it took me some time to work it out. The Python CIM access page was useful. aprx = arcpy.mp.ArcGISProject("current") myMap = aprx.listMaps("Map")[0] myLayer = myMap.listLayers("Home")[0] ...


1

I basically had it already. var pct = $feature.PerVax1; IIf(pct > "30%", $feature.PerVax1, ""); I forgot to mention I'm working in the label expression window.


2

This question has good answers already, but I thought I'd provide a dynamic solution for anyone who has this problem specifically with polygons that are only 4-sided (for example, rectangles showing the extents of lots of smaller maps over a larger map). This solution involves writing several python functions in the Function Editor. I am sure there are ways ...


0

I had the same problem, but for a different reason. I have used "View Unplaced Labels" bottom accidently from 'Labeling Tool Bar'. I unchecked that, and I am no longer had the duplication.


Top 50 recent answers are included