Hot answers tagged

7

You can use the label expression builder to create a label that incorporates any field of the feature. See the link provided or search labeling tag for examples


5

If I understand, you want aggregate a layer by location. You will need SQL for that, so create a virtual layer (Qgis >= 2.14) with a query like : SELECT geometry, count(*) AS count FROM your_layer GROUP BY geometry You can now use the "count" field of the virtual layer as label. For adding the filter by the text field : SELECT geometry, count(*) ...


5

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


5

Just figured it out. In the layer properties, go to the "Labels" tab, and set the Method to "Define classes of features and label each class differently". I set two different classes ("Default" and "2"), each with a different style and scale range. the label now changes its style according to scale range.


4

You can do this with two "Rule-based Labelling" labels, with no filters. This lets you put multiple labels on a feature. The first rule labels the feature with the attribute you want at the start, the second rule with the end attribute. Initially your labels will appear in the centre of the line, so we need to fix that. Do that with "data defined" ...


4

Nice question! PyQGIS to the rescue! Follow these steps to get a new field (in your original layer) called label with the number of points that lie in the same location: Active (select) your layer in the QGIS ToC. Run this code snippet in the QGIS Python console: from PyQt4.QtCore import QVariant lyr = iface.activeLayer() # Create New Field ...


3

You've got a little tied up constructing your string def label(wah, field): for lyr in arcpy.mapping.ListLayers(mxd): if lyr.name == wah: if lyr.supports("LABELCLASSES"): for lblClass in lyr.labelClasses: lblClass.expression = "<FNT size='8'>[{}]</FNT>".format(field) ...


3

There are a couple of solutions that spring to mind. The first is to create a field in your data that you can use an expression to set the RGB value dependent on your data. Then use this as the expression for both the fill color and text color (accessed by the little 'Data defined' tab beside each color picker). Another alternative would be to use ...


3

Your layer have to be in edit mode for enabling the tool. All the parameters in the Change Label box are data defined fields, so you need to have fields corresponding in your attibute table. After creating the new fields in the attribute table, go to the proprieties dialog, and setup the fields you want access. For exemple, for the X coordinate : The ...


3

Following the suggestion of @Joseph, I solved the question by this way: Assuming that there are already defined labels. Step 1: created two fields; xLabel and YLabel, decimal type, length 20, precision 4. Step 2: Layer Properties > Labels > Placement > Data defined, maped the X and Y fields in 'Attribute field' to match with the fields previously created ...


3

You could use the easy custom label plugin to move them where you want. See my blog post for a longer example of how this works.


3

You can show both diagrams and labels at the same time by enabling: Labels > Rendering > Show all labels for this layer (including colliding labels) If labels and/or diagrams overlap, you may need to adjust the Rendering and Placement settings.


2

This was an issue in QGIS 2.2 http://hub.qgis.org/issues/9792 and should be fixed now.


2

I had the same problem and what worked my problem was to choose the option "Free (slow)" in the menu "Placement", inside the labels settings. This way, the labels are not horizontal anymore, but they are all there.


2

For your case, that the current layer and the coverage layer don't share a similar field, you will need to use the following rule: within($geometry, @atlas_geometry) Some extras If the current layer and the coverage layer share a similar field, then you can use: "my_filed" = attribute(@atlasfeature, 'atlas_similar_field_name') Finally, if the layer you ...


2

I suggest that you use a custom rule-based placement for each feature label. You do this by creating a label-placement rule associated a unique value that the feature contains (e.g a id, gid or any other field which is unique). Go to properties for the layer (right click layer and choose properties) and pick the 'Labels' tab. Choose rule-based labelling in ...


2

I'm not sure where your single quotes came from in the expression. They aren't there in the hard-coded version, and they aren't needed. Change: lblClass.expression = "'["+field+"]'" to: lblClass.expression = "["+field+"]" Or, better yet: lblClass.expression = '[{0}]'.format(field) The string formatting is prettier (especially with longer string ...


1

Convert the font or image into an EMF vector graphic in graphic software such as Adobe Illustrator then use it as the picture marker symbol and it will be rendered as vector. You can also add any EMF vector (i.e. logo) to map layour as image and it will also render as vector. You can introduce 100% transparency to remove backround but only solid and 100% ...


1

It looks like the road is too short for the text to fit on, or it's too curvy. Check here for a similar solved question. A solution could be to either abbreviate the label, or simplifying the line might help. EDIT: if you don't want to change the road then you could use rule-based labelling and create a new rule solely for that single label: "name" = ...


1

you can use Rule-based labeling shapefile point before the rule all the points they label. after the rule: using rules you can specify which labels to show, even using conditional statements


1

Have you tried to activate option « Show all labels for this layer (including colliding labels) » ? This option is in the layer properties dialog > tab Labels > Rendering.


1

The problem is with map scale. Too short line for those words.


1

Create a polygon centroid, and then move the centroids where you want.


1

Try this. Rename your kmz to zip. Open the zip and rename the kml to txt (or just use open with). With your kml open in notepad or some other text editor look for the part of the html that says "LabelStyle" and change the "scale" number (Mine said 0 and I changed it to 0.666667) delete the entry for anything else (mine had color set to a string of 0's). ...


1

You can use the grid decoration under the view tab to create a semi-dynamic graticule annotation, that, while constant in its scale, updates when you pan the map. In the following example I've set the grid interval to 1000 meters. There's not much in the design department, but it works.


1

This should do the trick: def FindLabel ( [field1], [field2] ): if long([field2]) >= 1: return [field1] + "\n" + "(" + [field2] + ")" else: return [field1]


1

right click on the layer -> go to properties->go to labels -> tick 'label this layer with'-> click on the epsilon sign (expression dialog) and based on the example below type in your expression: 'data1: '||$rownum || ' data2: '|| $id ||'\n' ||'data2: '||$currentfeature || ' data3: '|| $scale where the $text is the name of a column hope it helps. Here ...


1

It seems that it depends on the font you're using. Try alternating among the following options: Bold: layer.setCustomProperty("labeling/namedStyle", "Bold") Italic: layer.setCustomProperty("labeling/namedStyle", "Italic") Bold and Italic: layer.setCustomProperty("labeling/namedStyle", "Bold Italic") If neither Bold or Italic are selected in your ...



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