Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
5

I can only give you a partial answer here without Python, but if most of your geometries are regular then the following might work. 1. Rule-based Labeling Firstly, to independently manage two separate labels, use Rule-based labeling. This lets you have separate labels for the same feature with settings independent of each other. Below I have two separate ...


3

You can do this with rule-based labeling Select the layer properties of the layer that you are labeling and select the Labels tab. At the top, select Rule-based labeling and add a rule for each label (location, time, people). If you want to display a label for every item in the table, just don't add a filter to the rule. You will need to play with the ...


2

You could use refFunctions plugin together with the expression geomwithin('polygon','$geometry') is NULL for that: Replace 'polygon' with the name of your polygonlayer. Just set the expression as filter and lables of points covered by the polygon will no longer be shown.


2

You can get the label text for each feature this way in QGIS 3: layer = iface.activeLayer() if layer.labelsEnabled(): labeling = layer.labeling() palyr = labeling.settings() expression = QgsExpression(palyr.fieldName) context = QgsExpressionContext() for feature in layer.getFeatures(): context.setFeature(feature) ...


2

The easiest way to do this is to duplicate the layer and then set the brush and pen styles to none. You can then have two sets of labels,and use data defined Coordinates to control the placement of them. I used x_min( $geometry) and y_max( $geometry) for one and the centroid for the other.


2

If it is not already a separate layer, separate Current Inventory from Previous Inventory using definition queries to create 2 layers. Use the Labeling toolbar, Label weights button to give the Current Inventory layer weights of a big number like 1000. That should push the other label away, however, it may have trouble placing it. It is hard to duplicate ...


2

You can find the quadrant position by using QgsPalLayerSettings::quadOffset(): layer.labeling().settings().quadOffset This returns an enum integer reflecting the QuadrantPosition (e.g. 0 = QuadrantAboveLeft, 1 = QuadrantAbove etc.). We can create a dictionary to contain these values and then get the quadrant position name using something like: layer = ...


2

You need to use the QgsProperty() and QgsPropertyCollection() classes to set the data defined properties. The enum property value 58 is for the background colour (see here for a list of data definable properties): layer = iface.activeLayer() background_color = QgsTextBackgroundSettings() background_color.setEnabled(True) # Set up the data-defined ...


1

Further testing: The pixelation is replicable - it is caused when there is a non-zero rotation applied to the SVG label background, or to the label as a whole via Placement. However, on export to PDF the background symbol is sharp. The resizing behaviour is not replicable. I made a new label from scratch using the same settings and SVG, and it works as ...


1

I'm not sure what's going wrong with your SVG symbol, but it's pretty simple to re-create a similar symbol using simple marker symbol levels. With simple markers, you can control the symbol size and stroke width using millimeters, points, pixels, meters at scale, map units, or inches. Add three symbol levels: Simple marker - line, 45 degree rotation. Shown ...


1

Frame Challenge: This is not a good method for what you're trying to achieve. Labels are always rendered on top of all the features on the map. So you'll never be able cover up the labels with a polygon. Instead, try replacing the labels with a font marker symbol. When you put a polygon on top of a point, all parts of the point symbol that fall underneath ...


1

You may want to create a qml stlye file. After you have set appropriate label style in the layer properties dialogue window: Click on [Style] button and open a small context menu. Select Save Style... which opens a new Save Layer Style window. Make sure Labels option is ticked. Save the style as a QML style file. Next time when you need the style back, ...


1

You can use the full XPath as context if they have a different one for each element. For example <element name="gmd:codeSpace" context="/gmd:MD_Metadata/gmd:referenceSystemInfo/gmd:MD_ReferenceSystem/gmd:referenceSystemIdentifier/gmd:RS_Identifier/gmd:codeSpace"> <label>Namespace</label> </element> <element ...


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