The Vector Properties Dialog:Labels Tab

提供: OSGeo.JP Wiki
2009年8月17日 (月) 19:56時点におけるKayama (トーク | 投稿記録)による版

(差分) ←前の版 | 最新版 (差分) | 次の版→ (差分)
移動: 案内検索

Labels Tab

The Labels tab allows you to enable labeling features and control a number of options related to fonts, placement, style, alignment and buffering. <P> We will illustrate this by labelling the lakes shapefile of the qgis_example_dataset: <P>

  1. Load the Shapefile alaska.shp and GML file lakes.gml in QGIS.
  2. Zoom in a bit to your favorite area with some lake.
  3. Make the lakes layer active.
  4. Open the Layer Properties dialog.
  5. Click on the Labels tab.
  6. Check the Display labels checkbox to enable labeling.
  7. Choose the field to label with. We'll use Field containing labelNAMES.
  8. Enter a default for lakes that have no name. The default label will be used each time QGIS encounters a lake with no value in the NAMES field.
  9. If have labels extending over several lines, check Multiline labels?. QGIS will check for a true line return in your label field and insert the line breaks accordingly. A true line return is a single character \n, (not two separate characters, like a backlash \ followed by the character n).
  10. Click Apply.

<P> Now we have labels. How do they look? They are probably too big and poorly placed in relation to the marker symbol for the lakes.

<P> Select the Font entry and use the Font and Color buttons to set the font and color. You can also change the angle and the placement of the text-label.

<P> To change the position of the text relative to the feature:

<P>

  1. Click on the Font entry.
  2. Change the placement by selecting one of the radio buttons in the Placement group. To fix our labels, choose the Right radio button.
  3. the Font size units allows you to select between Points or Map units.
  4. Click Apply to see your changes without closing the dialog.

<P> Things are looking better, but the labels are still too close to the marker. To fix this we can use the options on the Position entry. Here we can add offsets for the X and Y directions. Adding an X offset of 5 will move our labels off the marker and make them more readable. Of course if your marker symbol or font is larger, more of an offset will be required.

<P> The last adjustment we'll make is to buffer the labels. This just means putting a backdrop around them to make them stand out better. To buffer the lakes labels:

<P>

  1. Click the Buffer tab.
  2. Click the Buffer Labels? checkbox to enable buffering.
  3. Choose a size for the buffer using the spin box.
  4. Choose a color by clicking on Color and choosing your favorite from the color selector. You can also set some transparency for the buffer if you prefer.
  5. Click Apply to see if you like the changes.

<P> If you aren't happy with the results, tweak the settings and then test again by clicking Apply.

<P> A buffer of 1 points seems to give a good result. Notice you can also specify the buffer size in map units if that works out better for you.

<P> The remaining entries inside the Label tab allow you control the appearance of the labels using attributes stored in the layer. The entries beginning with Data defined allow you to set all the parameters for the labels using fields in the layer.

<P> Not that the Label tab provides a preview-box where your

selected label is shown.