New answers tagged labeling
Turn on the 3D Graphics toolbar, adjust some of the default text graphics properties before you add a label so that it is added large enough to see/find. Select the 3D Text tool Use the 3D Text tool to click on the feature you want to label, and type in the label you wish to display. Adjust the label properties for orientation and size. I've created ...
This should do the trick: def FindLabel ( [field1], [field2] ): if long([field2]) >= 1: return [field1] + "\n" + "(" + [field2] + ")" else: return [field1]
If I understand you, You need this
If 'Scaleable Vector Graphics' (.SVG) symbol is also an option, then yes you can use it for labeling objects (polygon in your case). Right click on the layer and navigate to Properties > Labels > Background. From the Shape dropdown select SVG and browse for the appropriate symbol as shown in the screen shot. As a result it will draw graphic symbols in the ...
I answer me myself. I don't like, but I only found this solution: I have used conditional function in label expression. "if" has 3 arguments (condition, label if true, label if not) This is the correct code from PyQt4.QtGui import QColor layer = iface.activeLayer() palyr = QgsPalLayerSettings() palyr.readFromLayer(layer) palyr.enabled = True ...
You need to set the "show label" expression (under Rendering) to "name" is not null and the label to "name".
For me in a simple: mc = self.iface.mapCanvas() lr = mc.labelingResults() extent = mc.extent() labellayer.startEditing() for lrl in lr.labelsWithinRect(extent): if lrl.layerID == labellayer.id(): angle = 90 - QgsPoint(lrl.cornerPoints).azimuth(QgsPoint(lrl.cornerPoints)) fieldIdx = labellayerpr.fields().indexFromName('xpos') ...
You could to use an expression for labeling. You not must to label the "Street" Field directly: exemple: wordwrap("Street", 14)
Not sure if this will help in your situation but you can try using the following expression for the Wrap on character option which checks the length of characters: CASE WHEN length("Street") > 15 THEN ' ' END This checks that if the total number of characters for a feature in the field "Street" is over 15, the wrap character becomes a space. So: ...
You can remove the labels with removeLayer(label) when the popup appears and add them to map again when it closes.
I think this is done using the WikiProject Geographical coordinates: WikiProject Geographical coordinates aims to better organize location information in articles containing a set of numbers that identifies location on and relative to the Earth.
I believe the answer by @iant is the best method to use (when you get it working, you should accept his answer). Just want to add that you can use the following expressions in your filter for your 3 individual rules (you can add rules by clicking the + as shown in the image, set the expression filter and the svg symbol): "myfield" < 1300 "myfield" > ...
I think your best option would be to use Rule Based classification - there are a number of tutorials available - I like this one from Linfiniti.
As an alternative to using code in the label parser, you can filter labels and have different label styles for different labels, by using Label Classes instead of changing the label parser: In your layer properties Label Tab, select "Define classes of features and label each class differently" from the Method drop-down. Click on the "Add" button to add a ...
Please follow the python syntax-Just check if hike is in the Name. Below should work def FindLabel ([Name]): if 'hike' in [Name]: return [Name] But if you need to label only Name does not contain hike use below- def FindLabel ([Name]): if 'hike' not in [Name]: return [Name] 'LIKE' is an SQL operator that may be used with ...
Just make separate label classes and query what you want for each class. Your first class would be for Rec IS NOT NULL and then the second class would be for Rec IS NULL. Edit your expression accordingly.
There is an option where you use a feature as an obstacle to discourage labeling other features if they are overlapping each other. But as far as I know, it just shift the labels of one layer if they are overlapped by another layer. For example in your case you want to prevent contour lines to be labeled when they are covered by "New scratch layer". So you ...
Your problem seems to be this line: TextSymbolizer text = sb.createTextSymbolizer(null, fonts, sb.createHalo(), sb.attributeExpression("Location"), pointPlacement, "Location"); Where you use Location for the text but I suspect it is your geometry. I use code like this as I have a label attribute with the text I require, see this blog post for a longer ...
Top 50 recent answers are included