New answers tagged

1

Here is one solution, I have tested on QGIS3.x Open the layer properties. Select Menu Label Select the color formula box and Select Edit... Type in the code area: @symbol_color And apply the changes PS: For some usages, I prefer a contrast color for the text. In this case I replace the previous formula with this one: /* Contrast color for text */ ...


0

i solve the problam as follow: var aaa = /* color: #d63000 */ee.Geometry.Point([30.0787, 37.5219]); var geometry=geometry2 // Applies scaling factors. function applyScaleFactors(image) { var opticalBands = image.select('SR_B.').multiply(0.0000275).add(-0.2); var thermalBands = image.select('ST_B.*').multiply(0.00341802).add(149.0); return image....


5

There is different solution: The simplest way but may be not applicable. You set the label to be only shown over a specific scale. Choose "rule-based labelling" and adjust the maximum zoom to fit your use case: Other solution, you can transform your country layer used for label to a line and the name of the country will only be shown when you see ...


0

thank you for your return. I will try. for now I have found a solution with Qgis: I duplicated my layer (4 layers because 4 variables). I chose a symbology 'group of points' and by clicking on the symbol of the cluster we can shift the symbol displayed from the centroid with x and y. cf capture ps.: my goal was to count the number of apartments, outbuildings,...


2

You can use rule based labeling


2

Use concat() function. It ignores NULL values and returns an empty string '' instead of NULL and therefore gives you a result if one or more fields are NULL. This is not the case for || concatenator. || returns NULL as result if at least one field/value is NULL. Use concat the following: concat("myfield_a",'my string a',"myfield_b",' --&...


2

Based on my understanding, you have Atlas layer that contain polygon. Some are made to be set the view on a regional scale and some are made to get a view at a local scale. These polygons can cross one another. In your example, you want to show a label that is in your map view, but that doesn't cross other polygons existing in your atlas layer. The solution ...


5

You could define an expression-based value on the labelfields. if(intersects($geometry, @atlas_geometry), '', "labelfield") This expression gives no label if it intersects the atlas_geometry. If not, a label will appear


3

To avoid labels being placed over objects from antother layer, use a label placement defined by Geometry generator and define a geometry that excludes the area around these objects (a buffer). Use this expression to exclude an area of 2000 map units around the points from the layer point for the postion of the labels: difference ( buffer($geometry,150), ...


3

In the labeling properties of the point layer, choose Blocking and set an obstacle weight.


0

You need the labelRect attribute. My way of getting the value of the labelReсt attribute is as follows. Take a point that intersects with some label(s). In my case, this point is the last position of the mouse cursor: point = iface.mapCanvas().mouseLastXY() point = iface.mapCanvas().getCoordinateTransform().toMapCoordinates(point) Since several labels can ...


5

For preventing label to get over your line layer just go to the labeling properties of your line layer (of course you could do that for any other layer you want to not be under label) then adjust your point layer label weight and the obstacle weight to get a result that suit you.


3

You should go to Layer properties -> Labels -> Placement Set label priority to low, click on "Settings" under Obstacles and give them the highest weight possible. Maybe this helps!


1

Did a quick test with the CSS above, the attribute name is label-rotation but indeed the style read and translated to SLD does not contain the rotation anymore... it's lost somehow (CSS is always translated to SLD, there is no specific CSS renderer, just FYI). Looks like a bug, please open a ticket in Jira.


2

You can achieve the desired output via the Rule-based labeling, see image below If the same styles should be applied, simply use the concatenation i.e. "Field1" || '-' || "Field2"


0

Add 2 fields to the featureclass: label_x,label_y (Type: real) and set the placement in the label options to those fields: Do NOT check the "Store Data in the project" option! layer=QgsProject.instance().mapLayersByName('xxx')[0] for feat in layer.getSelectedFeatures(): x=feat['label_x'] y=feat['label_y'] p1=QgsPointXY(x,y) buffer=...


12

Why obstacles do not work The setting Features act as obstacles only works for features of the same layer. Use Geometry generator to define label placement Go to Label / Placement tab and use Geometry generator to define the area inside the polygon where the label is allowed to be placed. Use an expression that excludes the area around the points: create a ...


4

Click data driven override for label opacity and select Assistant. Add the following expression, set values from/to to 0 and 1, and Opacity from / to to the opacity values you like (see screenshot at the bottom). The expression works like this: The idea is to first get an array of all layers with @layer_ids (line 3) Then for each of these layer (using ...


Top 50 recent answers are included