【译】QGIS培训手册-标签工具(2)

4.2.5. moderate跟我做:标记线要素 Follow Along: Labeling Lines

现在你已经知道如何使用标签,但是还有一个问题。点和多边形要素是很容易标注的,但是线要素呢?如果跟标记点和多边形要素那样来标记线要素,那结果就会这样:Now that you know how labeling works, there’s an additional problem. Points and polygons are easy to label, but what about lines? If you label them the same way as the points, your results would look like this:

../../../_images/bad_street_labels.png我们来重新设置一下 roads 图层,以便使它看上去更容易被理解。 We will now reformat the roads layer labels so that they are easy to understand.

  • 关闭 Places 图层,防止它对我们干扰。Hide the Places layer so that it doesn’t distract you.
  • 像之前一样为 streets 图层添加标签。Activate labels for the streets layer as before.
  • 将字体 大小 设置为 10 ,这样能看到更多的标签。Set the font Size to 10 so that you can see more labels.
  • 将视图放大到Swellendam镇所在的区域。Zoom in on the Swellendam town area.
  • 标签工具 对话框的 高级 选项卡下,选择如下设置。(译者注:最新版qgis已经不是这个操作界面,请注意识别。下同)In the Label tool dialog’s Advanced tab, choose the following settings:

../../../_images/street_label_settings.png你可能会发现标签文字的样式使用的是很难辨认的默认值,将标签文字格式设置为带浅黄色缓冲的深灰色或者黑色字。You’ll probably find that the text styling has used default values and the labels are consequently very hard to read. Set the label text format to have a dark-grey or black Color and a light-yellowbuffer.

这时候,缩放一下地图,你的地图会看上去这个样子。The map will look somewhat like this, depending on scale:

../../../_images/street_label_formatted.png你会看到有些街道的名称出现了不止一次,而这对我们而言可能没什么卵用。采取以下措施来防止出现此状况。You’ll see that some of the road names appear more than once and that’s not always necessary. To prevent this from happening:

  • 标签设置 对话框中,选择 渲染  选项,并选中合并相连的线条以防止重复标签。In the Label labelling settings dialog, choose the Rendering option and select theMerge connected lines to avoid duplicate labels:

../../../_images/merge_lines_option.png

  • 点击确定。Click OK

另一个有用的功能是防止一些太短的线要素标记上标签后你瞅不见它。Another useful function is to prevent labels being drawn for features too short to be of notice.

  • 在同一个渲染面板中,将小于这个尺寸的要素不贴标签的值设为5mm,点击应用并注意观察结果。In the same Rendering panel, set the value of Suppress labeling of features smaller than … to 5mm and note the results when you click Apply.

你可以自己试试不同的位置设置,就像我们之前看到的,标注道路的时候,并不适合水平选项,所以我们选弯曲。Try out different Placement settings as well. As we’ve seen before, the horizontal option is not a good idea in this case, so let’s try the curved option instead.

  • 图层标签设置对话框的位置面板中选择弯曲选项,Select the Curved option in the Placement panel of the Layer labeling settings dialog.

看一下结果:Here’s the result:

../../../_images/final_street_labels.png我们能看到,现在隐藏了很多之前能看到的标签,因为即便给这些弯曲缠绕的路打上标签也不易读,显得一团糟,你可以根据自己的需要和画面的表达来自己决定来用哪些选项。As you can see, this hides a lot of the labels that were previously visible, because of the difficulty of making some of them follow twisting street lines and still be legible. You can decide which of these options to use, depending on what you think seems more useful or what looks better.

发表评论

电子邮件地址不会被公开。 必填项已用*标注

填写验证码: *