QGIS 3.0 在线免费视频教程

最近发现好多朋友来博客的目的是寻找qgis相关的内容,早些年打算翻译的qgis训练手册也烂尾了,所以这段时间集中精力录制了几段qgis的视频教程,供大家参考。 虽然之前也录制过几段视频,但录制经验不足,有些地方读错发音,有的地方流畅度有待提升……唉,还望大家见谅哈。 不过,这个应该也算得上是国内少有的qgis视频教程了,还请大家多捧捧场。 继续阅读“QGIS 3.0 在线免费视频教程”

PPT绘图系列免费视频教程开课啦

经过一段时间的尝试,自己录制了几小段视频教程。现在本博主打算推出自己的视频教程产品。欢迎大家关注哦~

【额,因为是第一次尝试,录得不太好,还请各位多谅解】

目前的demo:

http://i.xue.taobao.com/detail.htm?spm=a2174.7765247.0.0.LNxCMU&courseId=89084

课程亮点:

课程亮点:

【译】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.

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

4.2. Lesson: 标签工具The Label Tool

标签可以被添加到地图来显示关于某对象的任何信息。任何矢量图层可以有与之关联的标签。这些标签是依靠其属性数据的内容创建的。Labels can be added to a map to show any information about an object. Any vector layer can have labels associated with it. These labels rely on the attribute data of a layer for their content.

Note

图层属性对话框里面有个标签选项,也有本节课所讲的功能,但是本节主要以工具栏上的标签工具来解说。The Layer Properties dialog does have a Labels tab, which now offers the same functionality, but for this example we’ll use the Label tool, accessed via a toolbar button.

本节目标:为某个图层添加有用好看的标签。The goal for this lesson: To apply useful and good-looking labels to a layer.

4.2.1. basic 跟我做:使用标签Follow Along: Using Labels

在使用标签工具之前,请先确定该工具已被激活。Before being able to access the Label tool, you will need to ensure that it has been activated.

  • 执行: 视图 ‣ 工具栏.Go to the menu item View ‣ Toolbars.
  • 确保标签 选项已被选中,若没被选中,那就现在选中它。Ensure that the Label item has a check mark next to it. If it doesn’t, click on the Label item, and it will be activated.
  • 在图层列表中点击places 图层,你会看到该层会被高亮显示。Click on the places layer in the Layers list, so that it is highlighted.
  • 点击工具栏上的这个按钮mActionLabeling。Click on the following toolbar button: mActionLabeling

这会打开 图层标签设置 对话框。This gives you the Layer labeling settings dialog.

  • 选中 给该图层加上标签,标签字段为…….Check the box next to Label this layer with….

这时候,你需要选择一个用于绘制标签的字段。根据之前的课程对本数据的了解,我们选择最适合做标签的 NAME 字段。You’ll need to choose which field in the attributes will be used for the labels. In the previous lesson, you decided that the NAME field was the most suitable one for this purpose.

  • 从列表中选择 name 字段。Select name from the list:

../../../_images/select_label_with.png

  • 点击 确定 。 Click OK.

现在,地图将添加上标签了,如下图。The map should now have labels like this:

../../../_images/first_place_names.png

4.2.2. basic 跟我做:更改标签选项Follow Along: Changing Label Options

基于之前课程你所设置的地图样式,你可能会发现标签的格式不太合适,或者他们距离其标注点太远/太近等等。Depending on the styles you chose for your map in earlier lessons, you’ll might find that the labels are not appropriately formatted and either overlap or are too far away from their point markers.

  • 点击工具栏上的按钮,再次打开 标签  工具。Open the Label tool again by clicking on its button as before.
  • 确保对话框左下方列表中的 文本  被选中。然后,你可以在其右侧的选项中更改其文本样式。Make sure Text is selected in the left-hand options list, then update the text formatting options to match those shown here:

../../../_images/label_formatting_options.png这样就可以解决字体不合适等问题了。接下来要解决标签与标注点重合的问题。开始之前,我们先看一下 使用轮廓缓冲区  选项。That’s the font problem solved! Now let’s look at the problem of the labels overlapping the points, but before we do that, let’s take a look at the Buffer option.

  • 还是打开标签工具对话框。Open the Label tool dialog.
  • 从左下框里面选使用轮廓缓冲区 。Select Buffer from the left-hand options list.
  • 勾选 绘制文本缓冲区 ,然后按照下图设置。Select the checkbox next to Draw text buffer, then choose options to match those shown here:

../../../_images/buffer_options.png

  • 点击应用。Click Apply.

这时你会看到我们给标签添加了一个彩色的缓冲区(或边框),让标签从地图上看起来更清楚。You’ll see that this adds a colored buffer or border to the place labels, making them easier to pick out on the map:

../../../_images/buffer_results.png现在我们来设置标签与标记点之间的位置。Now we can address the positioning of the labels in relation to their point markers.

  • 图层标签  对话框中,左下框中选中位置  。In the Label tool dialog, go to the Placement tab.
  • 选中 点周围 ,并将 距离 设置为2mm 。Change the value of Distance to 2mm and make sure that Around point is selected:

../../../_images/offset_placement_settings.png

  • 点击应用。Click Apply.

这时候你会看到标签将不会重叠在它们的标记点上了。You’ll see that the labels are no longer overlapping their point markers.

4.2.3. moderate 跟我做:用标签代替图层符号Follow Along: Using Labels Instead of Layer Symbology

在许多情况下,点的位置并不需要非常具体。例如, places 层中大多数点是代表了整个城镇或郊区,并与这些与要素关联的特定点在大比例尺下并不是很具体。事实上,给出一堆很具体的点往往会把阅读地图的人弄得更糊涂。In many cases, the location of a point doesn’t need to be very specific. For example, most of the points in the places layer refer to entire towns or suburbs, and the specific point associated with such features is not that specific on a large scale. In fact, giving a point that is too specific is often confusing for someone reading a map.

举一个例子: 在世界地图上,欧盟的点可能标注在波兰的某个地方,但阅读地图的人看到这个点在波兰后,他会认为欧盟的总部在波兰(【译者注】实际上在比利时首都布鲁塞尔)。To name an example: on a map of the world, the point given for the European Union may be somewhere in Poland, for instance. To someone reading the map, seeing a point labeledEuropean Union in Poland, it may seem that the capital of the European Union is therefore in Poland.

因此,为了防止这种误解,我们会停用点符号并将它们完全用标签来替代。So, to prevent this kind of misunderstanding, it’s often useful to deactivate the point symbols and replace them completely with labels.

在 QGIS,你可以通过改变标签位置,直接在它们引用点的位置来呈现。In QGIS, you can do this by changing the position of the labels to be rendered directly over the points they refer to.

  • 打开 places 图层的图层标签设置  对话框。Open the Layer labeling settings dialog for the places layer.
  • 选择 位置 选项。Select the Placement option from the options list.
  • 选中离点便宜量  单选按钮。Click on the Offset from point button.

这将显示象限选项,您可以使用象限选项设置标签与点标记的位置关系。在本例中,我们想要以点为中心,所以选择中心象限标签:This will reveal the Quadrant options which you can use to set the position of the label in relation to the point marker. In this case, we want the label to be centered on the point, so choose the center quadrant:

../../../_images/quadrant_offset_options.png

  • 通过编辑图层样式的方式来不显示点样式,具体为:将椭圆标记的宽度和高度的大小设置为 0,如下图。Hide the point symbols by editing the layer style as usual, and setting the size of the Ellipse marker width and height to 0:

../../../_images/hide_point_marker.png

  • 点击确定来查看结果。Click OK and you’ll see this result:

../../../_images/hide_point_marker_results.png如果你是要缩小地图,你会看到一些标签会消失以避免在缩小的地图上重叠。有时这是你想要的效果,特别是处理有很多点的数据集时;但在其他时候,这种方式将失去一些有用的信息。除这两种外,还有另一种可能性,我们将在以后的练习中了解学习。If you were to zoom out on the map, you would see that some of the labels disappear at larger scales to avoid overlapping. Sometimes this is what you want when dealing with datasets that have many points, but at other times you will lose useful information this way. There is another possibility for handling cases like this, which we’ll cover in a later exercise in this lesson.

4.2.4. moderate 动手试:自定义标签Try Yourself Customize the Labels

  • 返回到之前对标签和样式的设置,让点标记和标签偏移量为 2.00 毫米。在本阶段,你可以随意调整的点标记和标签的样式。Return the label and symbol settings to have a point marker and a label offset of 2.00mm. You may like to adjust the styling of the point marker or labels at this stage.

Check your results

  • 将比例尺设置为1:100000。可以在状态栏比例尺框中直接输入。Set the map to the scale 1:100000. You can do this by typing it into the Scale box in theStatus Bar.
  • 将标签调整到此比例尺下合适的样式。Modify your labels to be suitable for viewing at this scale.

Check your results

【译】QGIS培训教程-4.1属性数据

4. Module: 对矢量数据进行分类(Classifying Vector Data)

4.1. Lesson: 属性数据(Attribute Data)

到目前为止,我们对地图所做的更改并没有影响展示的要素。换句话说,所有的土地使用地区都是一样的,并且,所有的道路看起来也一样。当我们在看图时,读图者不会从图上独到任何道路的信息,他们只能看到某区域一条特定形状的路而已。(Up to now, none of the changes we have made to the map have been influenced by the objects that are being shown. In other words, all the land use areas look alike, and all the roads look alike. When looking at the map, the viewers don’t know anything about the roads they are seeing; only that there is a road of a certain shape in a certain area.)

但GIS的整体优势是地图上所有可见的对象都具有属性。GIS 中的地图并不只是图片。它不仅能描述物体的位置,而且带有这些对象的信息。(But the whole strength of GIS is that all the objects that are visible on the map also have attributes. Maps in a GIS aren’t just pictures. They represent not only objects in locations, but also information about those objects.)

本课目的:(The goal of this lesson: 探索对象的属性数据,并了解这些数据的用途。(To explore the attribute data of an object and understand what the various data can be useful for.)

4.1.1.  跟我做:属性数据Follow Along: Attribute data

打开的 places图层的属性表 (如有必要,请参阅”操作矢量数据”一节)。看一看,哪些字段信息最适合用来做标签呢,为什么?(Open the attribute table for the places layer (refer back to the section “Working with Vector Data” if necessary). Which field would be the most useful to represent in label form, and why?)

Check your results

4.1.2. 小结In Conclusion

你现在已经知道如何查看你所使用的数据的属性表了。只有带有我们关心的信息的数据集才是有用的。如果你知道你需要哪些属性,你可以快速判断某个给定的数据集是否有用,否则我们需要寻找另一个具有必需的属性数据的数据集。(You now know how to use the attribute table to see what is actually in the data you’re using. Any dataset will only be useful to you if it has the attributes that you care about. If you know which attributes you need, you can quickly decide if you’re able to use a given dataset, or if you need to look for another one that has the required attribute data.)

4.1.3. 下节提要What’s Next?

不同的属性可用于不同的目的。其中一些可以直接作为读图标签。下节课我们将重点学这个内容。(Different attributes are useful for different purposes. Some of them can be represented directly as text for the map user to see. You’ll learn how to do this in the next lesson.)

【译】QGIS培训手册-样式(4)

3.2.12. hard 跟我做:创建一个自定义的SVG填充(FOLLOW ALONG: CREATING A CUSTOM SVG FILL)

Note

注意,你需要首先安装一个免费的矢量编辑软件Inkscape,才能继续下面的练习。【译者注:如果你有illustrator、CorelDRAW等矢量软件,也可的。我到网上找了两个Inkscape的安装包,都打不开,装不上,所以没有试验过。】(To do this exercise, you will need to have the free vector editing software Inkscape installed.)

  • 启动Inkscape程序。(Start the Inkscape program.)

你会看到以下界面:(You will see the following interface:)

../../../_images/inkscape_default.png

你会看到它跟其他的一些矢量软件,比如Corel等类似。(You should find this familiar if you have used other vector image editing programs, like Corel.)

首先,我们把画布调整为适合小符号纹理的尺寸。(First, we’ll change the canvas to a size appropriate for a small texture.)

  • 点击菜单中的文件>文档属性。然后会填出文档属性对话框。(Click on the menu item File Document Properties. This will give you the Document Properties dialog.)
  • 将单位设置为像素(px。(Change the Units to px.
  • 将宽度和高度设置为 100。(Change the Width and Height to 100.)
  • 设置完后就关闭该对话框。(Close the dialog when you are done.)
  • 点击菜单上的视图>缩放>页面,来将视窗缩放到我们刚刚设置的页面上。(Click on the menu item View Zoom Page to see the page you are working with.)
  • 选择椭圆工具。(Select the Circle tool:)

../../../_images/inkscape_circle_tool.png

  • 按下ctrl  键,拖动椭圆工具来绘制一个正圆。(Click and drag on the page to draw an ellipse. To make the ellipse turn into a circle, hold thectrl button while you’re drawing it.)
  • 在所绘制的圆形上右键,打开填充画笔选项。(Right-click on the circle you just created and open its Fill and Stroke:)
  • 将填充和描边样式设置为下图所示:(Change the Stroke paint to a pale grey-blue and the Stroke style to a darker color with thin stroke:)

../../../_images/inkscape_stroke_fill.png

  • 用直线工具来绘制一条线:(Draw a line using the Line tool:)
  • 先点一下表示开始绘制直线,按下ctrl 键来保证直线偏移能以15度角的倍数变化。【译者注:目的是为了绘制出横平竖直的线条】(Click once to start the line. Hold ctrl to make it snap to increments of 15 degrees.)
  • 再点一下就绘制了一个线段,然后右键来完成直线的绘制。(Click once to end the line segment, then right-click to finalize the line.)
  • 改变直线的颜色和宽度,使之与之前的园的样式匹配,并对其进行适当移动,使之看起来这样:(Change its color and width to match the circle’s stroke and move it around as necessary, so that you end up with a symbol like this one:)

../../../_images/inkscape_final_symbol.png

  • 将其保存在exercise_data/symbols目录下,新建一个landuse_symbol  的文件夹,并保存为SVG格式。(Save it as landuse_symbol under the directory that the course is in, underexercise_data/symbols, as an SVG file.)

回到QGIS:(In QGIS:)

  • 打开landuse 图层的图层属性。(Open the Layer Properties for the landuse layer.)
  • 按照下图所示,通过浏览按钮来加载刚刚制作的svg图像,来改变图层的符号样式。(Change the symbol structure to the following and find your SVG image via the Browsebutton:)

../../../_images/svg_symbol_settings.png

并按下面改变svg图层的边框:(You may also wish to update the svg layer’s border:)

../../../_images/svg_layer_border.pnglanduse图层,现在会看起来是这个样了:(Your landuse layer should now have a texture like the one on this map:)

../../../_images/svg_symbol_result.png

3.2.13. 总结(IN CONCLUSION)

通过改变不同图层的符号样式可以将原来的矢量文件集合转变为一副清晰的地图。不但能看懂地图的内容,而且地图样式也很好看!(Changing the symbology for the different layers has transformed a collection of vector files into a legible map. Not only can you see what’s happening, it’s even nice to look at!)

3.2.14. 进阶阅读(FURTHER READING)

Examples of Beautiful Maps(这是一个国外的论坛链接,里面有好多漂亮的地图制作分享)

3.2.15. 下节提要(WHAT’S NEXT?)

通过更改整个图层的符号是有用的,但对读图者来说,每一层内包含的信息仍不可用。街道是叫什么名字?这个地方是属于哪个行政区域?农场的占地面积是多大?所有这些信息仍然是隐藏的。下一课中将解释如何将数据标示在你的地图上。(Changing symbols for whole layers is useful, but the information contained within each layer is not yet available to someone reading these maps. What are the streets called? Which administrative regions do certain areas belong to? What are the relative surface areas of the farms? All of this information is still hidden. The next lesson will explain how to represent this data on your map.)

Note

本节课中你养成经常保存的习惯了吗?Did you remember to save your map recently?

【译】QGIS培训手册-样式(3)

3.2.8. moderate 跟我做:对符号层次排序(Follow Along: Ordering Symbol Levels)

符号图层是按照一定的顺序进行渲染的,其方式类似于地图图层。这意味着在某些情况下,如果一个符号拥有很多符号图层可能会导致一些意外结果。(When symbol layers are rendered, they are also rendered in a sequence, similar to the way the different map layers are rendered. This means that in some cases, having many symbol layers in one symbol can cause unexpected results.)

  • 用之前介绍的方法为 roads  图层添加一个额外的符号图层。(Give the roads layer an extra symbol layer (using the method for adding symbol layers demonstrated above).)
  • 将线条宽度设置为0.3,边界样式设置为点虚线,线条颜色色设为白色。(Give the base line a Pen width of 0.3, a white color and select Dashed Line from thePen Style dropdown.)
  • Give the new, uppermost layer a thickness of 1.3 and ensure that it is a Solid Line.

你会看到地图变成了这个样子:(You’ll notice that this happens:)

../../../_images/bad_roads_symbology.png

好吧,这根本就不是我们想要设置的样子。(Well that’s not what we want at all!)

为了防止这种情况发生,你可以对符号图层进行排序从而控制不同的符号图层渲染呈现的顺序。(To prevent this from happening, you can sort the symbol levels and thereby control the order in which the different symbol layers are rendered.)

你可以通过以下方式来改变符号图层的顺序,在符号图层面板中选中 Line  层,并点击右侧下发的高级-> 符号层次。然后就会打开一个下面这样的对话框。(To change the order of the symbol layers, select the Line layer in the Symbol layers panel, then click Advanced -> Symbol levels…in the bottom right-hand corner of the window. This will open a dialog like this:)

../../../_images/symbol_levels_dialog.png

选中启用符号层次。你可以通过输入相关数字来调整他们的渲染顺序。0表示最底下的那层。Select Enable symbol levels. You can then set the layer ordering of each symbol by entering the corresponding level number. 0 is the bottom layer.

在此例中,我们会将顺序像这样翻转一下:(In our case, we want to reverse the ordering, like this:)

../../../_images/correct_symbol_layers.png

这样,白色的虚线将会呈现在黑线上面了。(This will render the dashed, white line above the thick black line.)

  • 点击两次确定,返回到地图。(Click OK twice to return to the map.)

地图变成了这样:(The map will now look like this:)

../../../_images/better_roads_symbology.png

现在,交汇点的道路现在”融合”了,所以一条路不会盖在另一条上。Also note that the meeting points of roads are now “merged”, so that one road is not rendered above another.

【译者注:这种方法改变的是渲染顺序,与选中要调整的符号图层后,使用符号图层面板下面的上下箭头来调整的图层排列顺序不同。改变排列顺序,道路的交汇处不会融合在一起,而使用他这种改变渲染顺序的方式,不仅会改变显示的顺序,道路端点交汇处还会融合到一起。或者可以这么理解:如果你不开启符号层次的这个功能,原来的矢量要素是依据其符号图层的设置,将第一根线渲染完毕后,再渲染第二根线,所以端点交汇处就会有遮盖而不是完美融合。而开启后呢,他是先把所有线的第一个符号图层样式渲染完,然后再渲染所有线的第二个图层样式……具体看下图:

QQ截图20150922172119

左边未开启,右边开启】

当你完成后,记得保存这个符号,以防止以后你还会要用到它。可以通过点击位于符号图层面板下面的保存符号按钮来保存当前符号。通常,你应该存储为QGIS Layer Style File 格式的样式文件。When you’re done, remember to save the symbol itself so as not to lose your work if you change the symbol again in the future. You can save your current symbol style by clicking the Save Style … button under the Style tab of the Layer Properties dialog. Generally, you should save as QGIS Layer Style File.

将样式保存在exercise_data/styles目录下面。你可以通过点击加载符号来加载一个之前存好的符号。在改变一个符号之前,要记住任何没有保存的符号都会丢失。(Save your style under exercise_data/styles. You can load a previously saved style at any time by clicking the Load Style …button. Before you change a style, keep in mind that any unsaved style you are replacing will be lost.)

 

3.2.10. hard  动手试(TRY YOURSELF)

符号图层也适用于分类的图层(比如有好几种样式符号的图层),但我们还没教到样式分类,所以你将使用一些基本的预分类数据。Symbol levels also work for classified layers (i.e., layers having multiple symbols). Since we haven’t covered classification yet, you will work with some rudimentary pre-classified data.

  • 创建一副新的地图,并仅添加 roads  数据集。(Create a new map and add only the roads dataset.)
  • 对其应用 exercise_data/styles目录下的 advanced_levels_demo.qml  样式。(Apply the style advanced_levels_demo.qml provided in exercise_data/styles.)
  • 缩放到Swellendam 地区。(Zoom in to the Swellendam area.)
  • 使用符号图层,保证图层的外边线看起来是下面这样的。(Using symbol layers, ensure that the outlines of layers flow into one another as per the image below:)

../../../_images/correct_advanced_levels.png

发表评论来验证你是否做对了

—————————————————–

  • 将符号图层按如下进行设置:(Adjust your symbol levels to these values:)
  • 试验用不同的值来得到不同的结果。(Experiment with different values to get different results.)
  • 在进行下一个练习之前,请打开你之前的那个地图。(Open your original map again before continuing with the next exercise.)

../../../_images/answer_road_symbol_layers.png

—————————————————–

3.2.11. moderate  跟我做:符号图层的类型(FOLLOW ALONG: SYMBOL LAYER TYPES)

除了设置填充颜色和使用预定义的样式,你也完全可以使用不同的符号图层类型。我们一直在使用到现在的唯一类型就是“简单填充”类型。更先进的符号图层类型允许你更进一步的自定义符号。(In addition to setting fill colors and using predefined patterns, you can use different symbol layer types entirely. The only type we’ve been using up to now was the Simple Fill type. The more advanced symbol layer types allow you to customize your symbols even further.)

每种类型的矢量(点、 线、 多边形) 都有其自己的符号图层类型集。首先我们先看看可用的点类型。Each type of vector (point, line and polygon) has its own set of symbol layer types. First we will look at the types available for points.

3.2.11.1. 点图层样式类型(POINT SYMBOL LAYER TYPES)

  • 打开basic_map  项目。(Open your basic_map project.)
  • 改变 places  图层的符号属性:(Change the symbol properties for the places layer:)

../../../_images/places_layer_properties.png

  • 你可以通过选择符号图层面板中的 Simple marker 图层来设置多种符号图层类型,然后点击(右侧的)符号图层类型下拉列表框:You can access the various symbol layer types by selecting the Simple marker layer in theSymbol layers panel, then click the Symbol layer type dropdown:

../../../_images/marker_type_dropdown.png

  • 尝试一下各种可选的选项,然后选择一个你认为比较合适的符号。Investigate the various options available to you, and choose a symbol with styling you think is appropriate.
  • 如果不知道怎么弄好,就设置成一个白边白绿色填充的圆形的点图案填充类型吧,并将其大小设置为3,00,边界宽度设置为0.5。(If in doubt, use a round Simple marker with a white border and pale green fill, with a sizeof 3,00 and an Outline width of0.5.)

3.2.11.2.线符号图层类型(LINE SYMBOL LAYER TYPES)

按以下来查看可用于行数据的各种选项:(To see the various options available for line data:)

  • 将 roads 图层的符号图层中最上面的那一层的类型改为“标记线”:(Change the symbol layer type for the roads layer’s topmost symbol layer to Marker line:)

../../../_images/change_to_marker_line.png

  • 在符号图层面板中选择刚刚出现的“简单标记”图层。将符号属性按下图进行设置:(Select the Simple marker layer in the Symbol layers panel. Change the symbol properties to match this dialog:)

../../../_images/simple_marker_line_properties.png

  • 将间隔设置为 1,00:(要选中“标记线”层)(Change the interval to 1,00:)

../../../_images/marker_line_interval.png

  • 在应用样式之前要确保符号层次是正确的 (通过我们先前使用的高级>符号层次对话框)。(Ensure that the symbol levels are correct (via the Advanced -> Symbol levels dialog we used earlier) before applying the style.)

应用了这个样式后,看看它的在地图上的结果。正如你所看到的这些符号能随着路改变方向,但不会随之弯曲。有些人喜欢这样,有些人不喜欢。如果你愿意,你可以将其调整回原来的样式。【译者注:我没有太明白这一段作者是啥意思,翻译的也可能不对,欢迎批评指正】(Once you have applied the style, take a look at its results on the map. As you can see, these symbols change direction along with the road but don’t always bend along with it. This is useful for some purposes, but not for others. If you prefer, you can change the symbol layer in question back to the way it was before.)

3.2.11.3. 多边形符号图层类型(POLYGON SYMBOL LAYER TYPES)

按此来查看用于多边形数据的各类选项:(To see the various options available for polygon data:)

  • 将 water  图层的符号图层类型进行调整,这个跟之前调整其他图层的操作类似。(Change the symbol layer type for the water layer, as before for the other layers.)
  • 研究一下列表中的不同选项能做些什么。(Investigate what the different options on the list can do.)
  • 按你的喜好对他们进行设置。(Choose one of them that you find suitable.)
  • 如果无从下手,可以按照以下的步骤使用点图案填充:(If in doubt, use the Point pattern fill with the following options:)

../../../_images/pattern_fill_size.png../../../_images/pattern_fill_distances.png

  • 添加一个新的符号图层,并设置为简单填充的类型。(Add a new symbol layer with a normal Simple fill.)
  • 将其填充色设为浅蓝色,边框设为深蓝色。(Make it the same light blue with a darker blue border.)
  • 通过下移箭头将此层调整到点填充图层的下面:(Move it underneath the point pattern symbol layer with the Move down button:)

../../../_images/simple_fill_move_down.png最后,你会得到一个有符号纹理的water层,而且你可以自由的设置和调整组成本符号纹理的点的大小、形状和间距。(As a result, you have a textured symbol for the water layer, with the added benefit that you can change the size, shape and distance of the individual dots that make up the texture.)

【译】QGIS培训手册-样式(2)

3.2.5. moderate 跟我做:缩放可视性Follow Along: Scale-Based Visibility

有时候你会发现,在给定的比例尺下,某些图层的表现会不太好。例如,各大洲的数据集可能不会有详细信息,当缩放到街道一级时就会不准确。当发生这种情况时,我们需要能够隐藏在不恰当的尺度下的数据集。(Sometimes you will find that a layer is not suitable for a given scale. For example, a dataset of all the continents may have low detail, and not be very accurate at street level. When that happens, you want to be able to hide the dataset at inappropriate scales.)

在本例中,我们要在把建筑物在缩放到小尺度时隐藏起来。如下图所示…(In our case, we may decide to hide the buildings from view at small scales. This map, for example …)

../../../_images/buildings_small_scale.png

……在这种尺度下,建筑物缩成一团很难辨认。(… is not very useful. The buildings are hard to distinguish at that scale.)

开启依赖于地图比例尺的可见性:(To enable scale-based rendering:)

  • 打开 buildings  图层的 图层属性 对话框。(Open the Layer Properties dialog for the buildings layer.)
  • 激活 通用 标签。(Activate the General tab.)
  • 勾选依赖于地图比例尺的可见性前面的复选框:(Enable scale-based rendering by clicking on the checkbox labeled Scale dependent visibility:)

../../../_images/scale_dependent_visibility.png

  • 将 Maximum的值调整到 1:10,000。(Change the Maximum value to 1:10,000.)
  • 点击确定。(Click OK.)

通过放大和缩小你的地图来检查效果,建筑物层会随着缩小和放大而消失和再现。(Test the effects of this by zooming in and out in your map, noting when the buildings layer disappears and reappears.)

Note

你可以使用鼠标滚轮来放大或缩小画面,或者,你可以通过缩放工具来缩放到某个范围:You can use your mouse wheel to zoom in increments. Alternatively, use the zoom tools to zoom to a window:

mActionZoomInmActionZoomOut

3.2.6. moderate跟我做:添加符号图层 Follow Along: Adding Symbol Layers

现在,你知道如何更改图层的简单符号了, 下一步是创建更复杂的符号系统。QGIS 允许你使用符号图层执行此操作。【译者注:所谓符号图层就是打开图层属性后,在“样式”tab下面有个框,框下班有加减号的图标等,在QGIS2.8等版本中,这个框的上面已经没有“Symbol layers”等字样了】(Now that you know how to change simple symbology for layers, the next step is to create more complex symbology. QGIS allows you to do this using symbol layers.)

  • 回到 landuse 层的样式属性面板中(通过在符号图层中点击简单填充)。(Go back to the landuse layer’s symbol properties panel (by clicking Simple fill in theSymbol layers panel).)

在此例中,当前的样式并没有边框。(即采用了不显示画笔的样式)In this example, the current symbol has no outline (i.e., it uses the No Pen border style).

选择符号图层面板中的填充,然后点击添加符号图层按钮。Select the Fill in the Symbol layers panel. Then click the Add symbol layer button:

../../../_images/add_symbol_layer_button.png

  • 点击它,画面会变为如下所示:(Click on it and the dialog will change to look somewhat like this:)

../../../_images/new_symbol_layer.png

(可能它的颜色会略有不同,但我们马上就会更改它了。)(It may appear somewhat different in color, for example, but you’re going to change that anyway.)

现在有第二个符号图层了。这个图层为简单填充(纯色),所以他会完全将之前的图层盖住。而且,它还有我们不想显示的实线边框样式。所以,我们要对它进行改造。(Now there’s a second symbol layer. Being a solid color, it will of course completely hide the previous kind of symbol. Plus, it has a Solid Line border style, which we don’t want. Clearly this symbol has to be changed.)

Note

记住不要把地图图层和符号图层弄混了。地图图层是一个已加载到地图中的矢量 (或栅格)数据。符号图层是用来表示一个图层符号样式的一部分。本课程将通常将地图图层称为图层,但符号图层将始终会用符号图层来称呼,以防止混淆。It’s important not to get confused between a map layer and a symbol layer. A map layer is a vector (or raster) that has been loaded into the map. A symbol layer is part of the symbol used to represent a map layer. This course will usually refer to a map layer as just a layer, but a symbol layer will always be called a symbol layer, to prevent confusion.

当新建的简单填充的层被选中后:With the new Simple Fill layer selected:

  • 将边界样式像之前那样设置为不显示画笔。(Set the border style to No Pen, as before.)
  • 将填充样式改为除实线填充【译者注:QGIS2.8中此处显示为实现填充,但不准确,应该是实物填充之类的?】或没有画笔之外的其他样式:(Change the fill style to something other than Solid or No brush. For example:)

../../../_images/new_fill_settings.png

  • 点击确定。现在你可以看到你的结果和并按需要调整它们。(Click OK. Now you can see your results and tweak them as needed.)

你甚至可以添加多个额外符号图层,并用这种方式为你的图层创建一种纹理。(You can even add multiple extra symbol layers and create a kind of texture for your layer that way.)

../../../_images/multiple_symbol_layers.png

这很有趣,但是对于制作一张地图来说,颜色太花哨了。(It’s fun! But it probably has too many colors to use in a real map…)

3.2.7. moderate Try Yourself

  • 现在用上面的方法为建筑物图层创建一个简单,但又不杂乱的纹理吧。记住如果需要的话要放大,否则建筑物显示不出来哦。(Remembering to zoom in if necessary, create a simple, but not distracting texture for thebuildings layer using the methods above.)

Check your results

【译】QGIS培训手册-样式

3.2. 样式(Lesson: Symbology)

图层的样式就是一个图层在地图上的表现形式。在表现空间数据方面,GIS与其他方式相比,它可以对数据进行动态化的可视化表达。The symbology of a layer is its visual appearance on the map. The basic strength of GIS over other ways of representing data with spatial aspects is that with GIS, you have a dynamic visual representation of the data you’re working with.)

因此,地图的可视外观 (这取决于各自的层数的样式) 是非常重要的。地图的最终用户需要能够很容易地看懂你制作的地图的意思。同样,在你探索数据的时候也需要看懂它们。这时候,好的样式就会很管用了。(Therefore, the visual appearance of the map (which depends on the symbology of the individual layers) is very important. The end user of the maps you produce will need to be able to easily see what the map represents. Equally as important, you need to be able to explore the data as you’re working with it, and good symbology helps a lot.)

换句话说,设置恰当的图层样式是非常有必要的。事实上,它对正确使用GIS和制作供他人使用的地图来说至关重要。In other words, having proper symbology is not a luxury or just nice to have. In fact, it’s essential for you to use a GIS properly and produce maps and information that people will be able to use.)

本节课的目标:能够为任何矢量图层创建任何样式。(The goal for this lesson: To be able to create any symbology you want for any vector layer.)

3.2.1. basic 跟我做:换换颜色(Follow Along: Changing Colors)

要改变图层的样式,请打开图层属性,让我们从改变 landuse层的颜色开始。(To change a layer’s symbology, open its Layer Properties. Let’s begin by changing the color of the landuse layer.)

  • 在图层列表中右键点击 landuse图层。(Right-click on the landuse layer in the Layers list.)
  • 在出现的菜单中选择属性。(Select the menu item Properties in the menu that appears.)

Note

默认情况下,你也可以通过双击图层的方式打开图层的属性对话框。(By default, you can also access a layer’s properties by double-clicking on the layer in the Layers list.)

属性窗口中:(In the Properties window:)

  • 在左侧选择样式选项卡:(Select the Style tab at the extreme left:)

../../../_images/layer_properties_style.png

  • 点击颜色标签右侧的颜色选择器。(Click the color select button next to the Color label.)

将会出现一个标准的颜色对话框。(A standard color dialog will appear.)

  • 选择一个灰色,并点击确定。(Choose a gray color and click OK.)
  • 图层属性窗口中再次点击确定,这时候你会看到设置好的颜色出现在地图上。(Click OK again in the Layer Properties window, and you will see the color change being applied to the layer.)

 

3.2.2. basic 动手试(Try Yourself)

请自己将 water 层的颜色设置为浅蓝色。(Change the water layer to a light blue color.)

3.2.3. basic 跟我做:改变样式的结构(Follow Along: Changing Symbol Structure)

到目前为止,看上去还不错。但除了颜色之外呢,图层的样式还有很多其他方面的内容。下一步我们将除去不同地块( landuse )之间的线条,使地图看上去更简洁。(This is good stuff so far, but there’s more to a layer’s symbology than just its color. Next we want to eliminate the lines between the different land use areas so as to make the map less visually cluttered.)

  • 打开 landuse 层的图层属性窗口。(Open the Layer Properties window for the landuse layer.)

样式选项卡下,你会看到跟之前一样的内容。这次,我们不仅仅是改变颜色了。(Under the Style tab, you will see the same kind of dialog as before. This time, however, you’re doing more than just quickly changing the color.)

  • 在 图层样式 面板中,展开 填充 下拉列表(如果没有展开的话),并选择 简单填充 选项:【译者注:在一些新的qgis版本中,界面布局可能与下面略有不同】(In the Symbol Layers panel, expand the Fill dropdown (if necessary) and select theSimple fill option:)

../../../_images/simple_fill_selected.png

  • 点开 线条样式 的下拉列表,这时候会看到实线、虚线的一些选项。(Click on the Border style dropdown. At the moment, it should be showing a short line and the words Solid Line.)
  • 选择 不显示画笔 (Change this to No Pen.)
  • 点击 确定。(Click OK.)

现在landuse图层在区域之间将不再有线条分隔了。( Now the landuse layer won’t have any lines between areas.)

3.2.4. basic 动手试(Try Yourself)

  • water 层的样式调整为:带有深蓝色边线。(Change the water layer’s symbology again so that it is has a darker blue outline.)
  • rivers 层的样式调整为:将水道(waterways)调整为合适的样式。(Change the rivers layer’s symbology to a sensible representation of waterways.)

回复本文来查看你是否做对了~

——————————————————————————
你的地图会看起来像这样子:(Your map should now look like this:)

../../../_images/answer_symbology1.png

如果你是初学者的话,你可以在此止步了。【译者注:不用止步,初学者也可以尝试做下面的三行练习】(If you are a Beginner-level user, you may stop here.)

  • 用之前上面说到的方法来改变其他图层的颜色和样式。(Use the method above to change the colors and styles for all the remaining layers.)
  • 尝试用贴切自然的颜色来表达各个对象。比如,道路不应该是红色或蓝色的,它应该是灰色或者黑色。【译者注:中国好像喜欢用红啊黄啊的表示道路捏】(Try using natural colors for the objects. For example, a road should not be red or blue, but can be gray or black.)
  • 同时,请自由的探索改变多边形填充样式和线条样式的不同方法。(Also feel free to experiment with different Fill Style and Border Style settings for the polygons)


——————————————————————————

【译】操作矢量数据

3.1. 操作矢量数据(Lesson: Working with Vector Data)

矢量数据无疑是GIS日常操作中最常见的一种数据。它以点、线和多边形的形式来描绘地理数据。矢量数据集中的每个对象被称为形状(feature),并有相对应的数据与之关联。(Vector data is arguably the most common kind of data you will find in the daily use of GIS. It describes geographic data in terms of points, that may be connected into lines and polygons. Every object in a vector dataset is called a feature, and is associated with data that describes that feature.)

本节课的目的:学习矢量数据的结构,并掌握如何加载他们到地图中。(The goal for this lesson: To learn about the structure of vector data, and how to load vector datasets into a map.)

3.1.1. basic 跟我做:查看图层属性(Follow Along: Viewing Layer Attributes)

首先要明确的是,我们即将操作的数据,不仅代表了他们在空间中的位置,还包含了他们是什么的各种属性(It’s important to know that the data you will be working with does not only represent where objects are in space, but also tells you what those objects are.)

接前面的练习,在你的地图中已经加载了道路层。你也可以看到现在只是展示了道路的位置。(From the previous exercise, you should have the roads layer loaded in your map. What you can see right now is merely the position of the roads.)

要看到所有的形状要素属性,先在图层列表面板中选中该图层。(To see all the data available to you, with the roads layer selected in the Layers panel:)

  • 点击这个按钮:attributes(Click on this button: attributes

你会看到一个关于道路图层有更多信息的数据表。这些额外的数据被称为属性数据。在地图中能看到的那些线条是空间数据。(It will show you a table with more data about the roads layer. This extra data is called attribute data. The lines that you can see on your map represent where the roads go; this is the spatial data.)

这是GIS中很常见的一些定义,比较重要,请记住它们。(These definitions are commonly used in GIS, so it’s essential to remember them!)

  • (现在,可以关闭属性表了)You may now close the attribute table.

矢量数据在坐标平面上以点、 线和多边形的形式来表现图形要素。它通常用于存储离散的图形要素,如道路和城市街区等。(Vector data represents features in terms of points, lines and polygons on a coordinate plane. It is usually used to store discrete features, like roads and city blocks.)

3.1.2. basic 跟我做:从shp加载矢量数据(Follow Along: Loading Vector Data From Shapefiles)

Shapefile 是一种可以将 GIS 数据存储在一组关联的多个文件中的特定文件格式【译者注:每个shp文件都是由多个文件组成的】。这些文件有共同的文件名,但是有各自的不同的扩展名(文件类型)。Shapefiles 可以很方便的来回发送,并且大多数 GIS 软件都可以阅读它们。(The Shapefile is a specific file format that allows you to store GIS data in an associated group of files. Each layer consists of several files with the same name, but different file types. Shapefiles are easy to send back and forth, and most GIS software can read them.)

参考上一节所讲的如何加载矢量图层的方法,(Refer back to the introductory exercise in the previous section for instructions on how to add vector layers.)

把以下数据集加载到地图中:(Load the data sets into your map following the same method:)

  • “places”
  • “water”
  • “rivers”
  • “buildings”

 

3.1.3. basic 跟我做:从数据库中加载矢量数据(Follow Along: Loading Vector Data From a Database)

数据库能够让你在一个文件中存储了大量的相关联的数据。您可能已经对类似 Microsoft Access这样的 数据库管理系统 (DBMS)有所了解。GIS应用程序也可以使用的数据库。具有地理信息系统特性的 DBMS (比如 PostGIS) 会有额外的功能,因为他们需要处理空间数据。(Databases allow you to store a large volume of associated data in one file. You may already be familiar with a database management system (DBMS) such as Microsoft Access. GIS applications can also make use of databases. GIS-specific DBMSes (such as PostGIS) have extra functions, because they need to handle spatial data.)

  • 点击这个按钮:mActionAddSpatiaLiteLayer(Click on this icon: mActionAddSpatiaLiteLayer

(如果你找不到该按钮,检查 图层管理 工具栏是否被打开)(If you’re sure you can’t see it at all, check that the Manage Layers toolbar is enabled.)

将打开一个新的对话框。在这个对话框中:(It will give you a new dialog. In this dialog:)

  • 点击新建 按钮。(Click the New button.)
  • 在之前的路径下,找到landuse.sqlite这个文件。选中它,并打开。(In the same folder as the other data, you should find the file landuse.sqlite. Select it and click Open.)

你会看到在刚刚的那个对话框里面,三个按钮的上面已经填写上了 “land_use.db@…”这样的文字,@后面跟着的是你计算机上数据库文件的路径。You will now see the first dialog again. Notice that the dropdown select above the three buttons now reads “land_use.db@…”, followed by the path of the database file on your computer.

  • 点击 连接 按钮。你会发现在原来的空白区域多出了一条内容:(.Click the Connect button. You should see this in the previously empty box:)

../../../_images/spatiallite_dialog_connected.png

  • 点击 landuse 图层来选中它,然后点击 添加按钮。(Click on the landuse layer to select it, then click Add)

Note

记得要养成经常保存地图的习惯!地图文件不会直接包含任何数据,但是它会记住那些已被加载的图层。(Remember to save the map often! The map file doesn’t contain any of the data directly, but it remembers which layers you loaded into your map.)

3.1.4. 跟我做:给图层排序(Follow Along: Reordering the Layers)

在图层列表中的图层会按照一定的顺序进行绘制。在列表顶部的图层最先绘制,列表底部的图层最后绘制。通过更改它们在列表中排列的顺序,可以更改绘制它们的顺序。(The layers in your Layers list are drawn on the map in a certain order. The layer at the bottom of the list is drawn first, and the layer at the top is drawn last. By changing the order that they are shown on the list, you can change the order they are drawn in.)

Note

根据你所使用的 QGIS 的版本,在图层列表下面可能会有一个叫控制渲染顺序 的复选框。如果想要实现通过上下排序来控制图层先后顺序,必须将这个复选框选中。如果您的版本的 QGIS 没有此选项,它就是默认开启的,你不需要担心这件事【译者注:在最新的QGIS版本中,已经没有了这个复选框】。(Depending on the version of QGIS that you are using, you may have a checkbox beneath your Layers list reading Control rendering order. This must be checked (switched on) so that moving the layers up and down in the Layers list will bring them to the front or send them to the back in the map. If your version of QGIS doesn’t have this option, then it is switched on by default and you don’t need to worry about it.)

当前已经加载的图层可能绘制的顺序是不合逻辑的。比如道路可能是完全被挡住的,因为有别的图层在它上面。The order in which the layers have been loaded into the map is probably not logical at this stage. It’s possible that the road layer is completely hidden because other layers are on top of it.

比如说这种图层顺序(landuse就会把road挡住):(For example, this layer order..).

../../../_images/incorrect_layer_order.png

通过以下措施来解决这个问题:(To resolve this problem:)

  • 按住并拖拽某个图层(来调整顺序)(Click and drag on a layer in the Layers list.)
  • 将各个图层按以下顺序排序:(Reorder them to look like this:)

../../../_images/correct_layer_order.png现在地图变得更有意义了,道路和建筑物出现在土地使用区域的上面。(You’ll see that the map now makes more sense visually, with roads and buildings appearing above the land use regions.)

3.1.5.小结( In Conclusion)

现在你已经学会了添加不同来源的矢量图层。(Now you’ve added all the layers you need from several different sources.)

3.1.6. What’s Next?

使用加载图层时随机生成的样式和颜色可能会导致你的地图不太好识别。所以我们要自己来设定他们的颜色和符号,这就是下一节课的内容。(Using the random palette automatically assigned when loading the layers, your current map is probably not easy to read. It would be preferable to assign your own choice of colors and symbols. This is what you’ll learn to do in the next lesson.)