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

【译】QGIS培训手册-操作界面概览

2.3. 操作界面概览(Lesson: An Overview of the Interface)

QGIS 用户界面主要由菜单、 工具栏、 地图画布和图层列表等组成。【译者注:老外说话真tm啰嗦】We will explore the QGIS user interface so that you are familiar with the menus, toolbars, map canvas and layers list that form the basic structure of the interface.

本节课的目的:理解QGIS界面的基本知识。(The goal for this lesson: To understand the basics of the QGIS user interface.)

2.3.1. basic动手试:界面基础( Try Yourself: The Basics)

../../../_images/gui_numbered.png上图中标号的各部分内容分别为:(The elements identified in the figure above are:)

  1. 图层列表 / 资源管理器面板(Layers List / Browser Panel)
  2. 工具栏(Toolbars)
  3. 地图画布(Map canvas)
  4. 状态栏(Status bar)
  5. 侧工具栏(Side Toolbar)

2.3.1.1. basic 图层列表(The Layers List)

在图层列表中,你能看到所有可用图层的列表。(In the Layers list, you can see a list, at any time, of all the layers available to you.)

通过展开折叠项目 (通过单击它们前面的加号) 将为你提供该图层的当前外观的详细信息。(Expanding collapsed items (by clicking the arrow or plus symbol beside them) will provide you with more information on the layer’s current appearance.)

右键点击某个图层,会得到一个很多选项的菜单。过会你会用到这个里面的一些内容,所以先看一下都有哪些选项。(Right-clicking on a layer will give you a menu with lots of extra options. You will be using some of them before long, so take a look around!)

某些版本的QGIS在图层列表的下方有一个单独控制渲染顺序的复选框。别担心如果你不能看到它。如果你没看到,那就不要管他了。如果看到了,就请把它选中。(Some versions of QGIS have a separate Control rendering order checkbox just underneath the Layers list. Don’t worry if you can’t see it. If it is present, ensure that it’s checked for now.)

Note

每个矢量图层都是一个特定类型的数据集,比如道路、 树木等。矢量图层只有点、 线或多边形三种类型。(A vector layer is a dataset, usually of a specific kind of object, such as roads, trees, etc. A vector layer can consist of either points, lines or polygons.)

2.3.1.2. basic 资源管理器面板(The Browser Panel)

QGIS 资源管理器可以让你轻松地在数据库中导航和管理数据文件。可以访问到常见的矢量文件 (例如 ESRI shapefile 或 MapInfo 文件),数据库 (e.g.PostGIS,Oracle、 Spatialite 或 MSSQL 空间) 和 WMS/WFS连接,还可以查看GRASS数据。(The QGIS Browser is a panel in QGIS that lets you easily navigate in your database. You can have access to common vector files (e.g. ESRI shapefile or MapInfo files), databases (e.g.PostGIS, Oracle, Spatialite or MSSQL Spatial) and WMS/WFS connections. You can also view your GRASS data.)

2.3.1.3. basic 工具栏(Toolbars)

你最常使用的工具集可以变成基本访问工具栏。例如,文件工具栏允许您保存、 加载、 打印,并开始一个新项目。你可以轻松地自定义界面,只保留自己最常用的工具栏,可以通过视图 ‣ 工具栏菜单添加或删除工具栏。(Your most oft-used sets of tools can be turned into toolbars for basic access. For example, the File toolbar allows you to save, load, print, and start a new project. You can easily customize the interface to see only the tools you use most often, adding or removing toolbars as necessary via the View ‣ Toolbars menu.)

即使某些工具在工具栏中不可见,所有的工具仍可通过菜单访问。例如,如果您删除文件工具栏 (其中包含保存按钮),您仍可以通过单击文件菜单中的保存来保存您的地图。Even if they are not visible in a toolbar, all of your tools will remain accessible via the menus. For example, if you remove the File toolbar (which contains the Save button), you can still save your map by clicking on the File menu and then clicking on Save.

2.3.1.4. basic 地图画布(The Map Canvas)

这是展示地图的区域(This is where the map itself is displayed.)

2.3.1.5. basic 状态栏(The Status Bar)

向你展示当前地图的信息,同时也允许您调整地图尺寸和查看鼠标光标在当前地图上的坐标。(Shows you information about the current map. Also allows you to adjust the map scale and see the mouse cursor’s coordinates on the map.)

 

2.3.2. basic自己试试1( Try Yourself 1)

在你自己的电脑屏幕上看看有没有找到上面提到的几个功能区。看看你能否说出它们的名称和功能。通过练习,你将变得更加熟悉这些元素,之后我们会使用它们。(Try to identify the four elements listed above on your own screen, without referring to the diagram above. See if you can identify their names and functions. You will become more familiar with these elements as you use them in the coming days.)

 

 

2.3.3. basic 自己试试 2( Try Yourself 2)

试着从操作界面上找到下面的工具,他们都是做什么用的?Try to find each of these tools on your screen. What is their purpose?

  1. mActionFileSaveAs

  2. mActionZoomToLayer

  3. mActionWhatsThis

  4. ../../../_images/toggle_render.png
  5. mActionMeasure

Note

如果这些工具在屏幕上不可见,尝试启用一些当前隐藏的工具栏。也请记住,如果屏幕上没有足够的空间,可以通过隐藏一些工具缩短工具栏。通过点击折叠的工具栏中的双右箭头按钮,可以看到隐藏的工具。通过将您的鼠标停靠在工具上一段时间,你可以看到该工具的名称和该工具的提示。(If any of these tools is not visible on the screen, try enabling some toolbars that are currently hidden. Also keep in mind that if there isn’t enough space on the screen, a toolbar may be shortened by hiding some of its tools. You can see the hidden tools by clicking on the double right arrow button in any such collapsed toolbar. You can see a tooltip with the name of any tool by holding your mouse over the tool for a while.)

检查结果:通过发表评论看看你自己是否掌握了

—————————————————-

  1. 另存为(Save as)
  2. 缩放到图层(Zoom to layer)
  3. 帮助(Help)
  4. 打开/关闭地图渲染(Rendering on/off)
  5. 测量距离(Measure line)


—————————————————-

2.3.4. 接下来学啥?(What’s Next?)

现在您已经知道了QGIS界面是如何操作的,你可以使用这些工具来改进你的地图了!这是下一课的主题。(Now you’ve seen how the QGIS interface works, you can use the tools available to you and start improving on your map! This is the topic of the next lesson.)

原作者:Linfiniti Consulting CC.   翻译:数据地图博客

【译】QGIS培训手册-添加第一个图层

2.2. 添加第一个图层(Lesson: Adding your first layer)

我们将启动该应用程序,并创建一个基本的地图,用来示范和练习。(We will start the application, and create a basic map to use for examples and exercises.)

本课目标:从示例地图开始学(The goal for this lesson: To get started with an example map.)

Note

在开始这项工作之前, 你的计算机上必须已经安装有QGIS。另外,你可以从QGIS data downloads area下载training_manual_exercise_data.zip文件,用于本次练习。(Before starting this exercise, QGIS must be installed on your computer. Also, download thetraining_manual_exercise_data.zip file from the QGIS data downloads area.)

根据你具体的安装情况,从桌面或者开始菜单中启动QGIS。(Launch QGIS from its desktop shortcut, menu item, etc., depending on how you configured its installation.)

Note

本次课程的截图来自MacOS版本的QGIS 2.0,根据你的电脑的实际情况,你看到的操作界面可能与此不同。但是所有按钮的样式是相同的,所有的操作在任何操作系统上都是可以实现的。你需要安装QGIS2.0来使用本教程。【译者注:截止到2015年8月4日,QGIS最新版本为2.10.1,不管你安装哪个版本,都可以使用本教程】The screenshots for this course were taken in QGIS 2.0 running on MacOS. Depending on your setup, the screens you encounter may well appear somewhat different. However, all the same buttons will still be available, and the instructions will work on any OS. You will need QGIS 2.0 (the latest version at time of writing) to use this course.

让我们立马开始吧!(Let’s get started right away!)

 

2.2.1. basic 跟我做:准备一张地图(Follow Along: Prepare a map)

  • 打开QGIS,你会看到一个新建的空白地图。(Open QGIS. You will have a new, blank map.)
  • 找到添加矢量图层按钮mActionNewVectorLayer。(Look for the Add Vector Layer button: mActionNewVectorLayer
  • 点击它打开以下对话框:(Click on it to open the following dialog:)

../../../_images/add_vector_dialog.png

  • 点击浏览按钮,导航到 exercise_data/epsg4326/roads.shp 这个文件(在示例数据集的目录下)。选中该文件后,点击打开。你会看到刚刚那个对话框,但是文件路径填写在数据源的文本框里了。继续点击打开。你指定的数据将被加载到窗口中。(Click on the Browse button and navigate to the file exercise_data/epsg4326/roads.shp (in your course directory). With this file selected, click Open. You will see the original dialog, but with the file path filled in. Click Open here as well. The data you specified will now load.)

恭喜你!你现在完成了一个基本的地图。现在让我们来保存一下当前的工作。(Congratulations! You now have a basic map. Now would be a good time to save your work.)

  • 点击另存为按钮:mActionFileSaveAs。(Click on the Save As button: mActionFileSaveAs
  • 将地图保存在 exercise_data/ 路径下,并取名为 basic_map.qgs 。(Save the map under exercise_data/ and call it basic_map.qgs.)

检查结果(通过发表评论,检查你是否做对了):

——————————————————-

你会看到许多的线条,各式各样的道路。这些线条都来自你刚刚加载的图层。(You should see a lot of lines, symbolizing roads. All these lines are in the vector layer that you just loaded to create a basic map.)

——————————————————-

2.2.2. 小结(In Conclusion)

你已经学会了如何添加一个图层,并创建一个基本的地图!(You’ve learned how to add a layer and create a basic map!)

2.2.3. 接下来学什么?(What’s Next?)

现在你已经知道了如何使用添加矢量图层按钮但是所有其他的按钮是干啥的?这个操作界面是如何工作的呢?在我们学习更多内容之前让我们好好 QGIS 操作界面总体布局这就下一主题。(Now you’re familiar with the function of the Add Vector Layer button, but what about all the others? How does this interface work? Before we go on with the more involved stuff, let’s first take a good look at the general layout of the QGIS interface. This is the topic of the next lesson.)

原作者:Linfiniti Consulting CC.   翻译:数据地图博客

【译】QGIS培训手册-简介

2.1. 简介(Lesson: A Brief Introduction)

欢迎来到我们的课程!接下来我们将你学会如何轻松高效地使用 QGIS如果你是GIS新手我们会告诉你从什么开始如果你是一个有经验用户您将看到 QGIS能实现所有期待的所有GIS软件功能和更多内容。(Welcome to our course! Over the next few days, we’ll be showing you how to use QGIS easily and efficiently. If you’re new to GIS, we’ll tell you what you need to get started. If you’re an experienced user, you’ll see how QGIS fulfills all the functions you expect from a GIS program, and more!)

本单元中,我们将介绍 QGIS这个开源 项目以及它的用户界面。(In this module we introduce the QGIS project itself, as well as explaining the user interface.)

完成章节的学习后将:能够正确识别 QGIS 窗口中主要元素,知道它们的具体用途,并能会加载shp文件到QGIS中。(After completing this section, you will be able to correctly identify the main elements of the screen in QGIS and know what each of them does, and load a shapefile into QGIS.)

警告Warning

课程包括有关添加 删除改变 GIS 数据集指令我们之前已经提供过相关示例数据集在操作和使用你自己数据之前,确保已经备份!(This course includes instructions on adding, deleting and altering GIS datasets. We have provided training datasets for this purpose. Before using the techniques described here on your own data, always ensure you have proper backups!)

2.1.1. 如何使用本教程(How to use this tutorial)

任何 像我这样的文字  表示可以点击的链接。(Any text that looks like this refers to something on the screen that you can click on.)

任何 像 ‣ 我这样 ‣的文字 表示菜单或操作步骤(Text that looks ‣ like ‣ this directs you through menus.)

像我这样的文字表示你要输入的内容,比如一句命令,路径或文件名。(This kind of text refers to something you can type, such as a command, path, or file name.)

2.1.2. 课程目标(Tiered course objectives)

课程迎合不同经验水平的用户需求分为三个级别根据你自己的实际情况可以有不同课程训练内容和成果每个级别所包含的信息和内容都对下一个级别至关重要,所以,请确保完成你所处的级别和低于你级别的所有练习。(This course caters to different user experience levels. Depending on which category you consider yourself to be in, you can expect a different set of course outcomes. Each category contains information that is essential for the next one, so it’s important to do all exercises that are at or below your level of experience.)

2.1.2.1. basic初级(绿色标签)( Basic)

在这个类别,课程将假定你有很少或没有事先熟悉GIS(地理信息系统)的理论知识或GIS程序的操作。(In this category, the course assumes that you have little or no prior experience with theoretical GIS knowledge or the operation of a GIS program.)

我们会提供有限理论知识背景来解释在QGIS中具体操作目的,重点是你要边学边做。(Limited theoretical background will be provided to explain the purpose of an action you will be performing in the program, but the emphasis is on learning by doing.)

当您完成该课程时,你将会对GIS有更好的概念理解,并能知道如何通过 QGIS来运用它们。(When you complete the course, you will have a better concept of the possibilities of GIS, and how to harness their power via QGIS.)

2.1.2.2. moderate中级(蓝色标签)( Intermediate)

在此级别中,我们假定你有GIS工作知识和经验,并每天使用它们。(In this category, it is assumed that you have working knowledge and experience of the everyday uses of GIS.)

按照初级水平的有关步骤操作,QGIS会把你带到熟悉的场景中,使你意识到 QGIS 与其他GIS软件的不同之处,并学习如何在 QGIS 中使用分析功能。(Following the instructions for the beginner level will provide you with familiar ground, as well as to make you aware of the cases where QGIS does things slightly differently from other software you may be used to. You will also learn how to use analysis functions in QGIS.)

当您完成该课程时,你将能很熟练的使用 QGIS 来处理所有你平时所使用的一些GIS功能。(When you complete the course, you should be comfortable with using QGIS for all of the functions you usually need from a GIS for everyday use.)

2.1.2.3. hard 高级(红色标签)(Advanced)

在此级别中,我们假定你是经验丰富的GIS使用者, 了解并使用过空间数据库,使用过在远程服务器上的数据,并编写过分析脚本等等。(In this category, the assumption is that you are experienced with GIS, have knowledge of and experience with spatial databases, using data on a remote server, perhaps writing scripts for analysis purposes, etc.)

遵循另外两个级别的指导能够让你熟悉QGIS的界面操作,并能确保你掌握你所需要的功能。你也会学习到如何使用QGIS的插件系统,数据访问系统等等。(Following the instructions for the other two levels will familiarize you with the approach that the QGIS interface follows, and will ensure that you know how to access the basic functions that you need. You will also be shown how to make use of QGIS’ plugin system, database access system, and so on.)

完成课程会熟练掌握 QGIS的日常使用操作,和它高级功能。(When you complete the course, you should be well-acquainted with the everyday operation of QGIS, as well as its more advanced functions.)

2.1.3. 为什么选择QGIS?(Why QGIS?)

随着信息与空间之间的关联越来越密切,目前并不缺乏能够履行部分全部常用 GIS 功能的软件。那为什么要使用 QGIS而不是其他的GIS软件呢?As information becomes increasingly spatially aware, there is no shortage of tools able to fulfill some or all commonly used GIS functions. Why should anyone be using QGIS over some other GIS software package?)

这里只是一些原因:(Here are only some of the reasons:)

  • 它是免费的安装使用 QGIS 程序金钱成本为零初始没有年度订阅费用什么都没有。(It’s free, as in lunch. Installing and using the QGIS program costs you a grand total of zero money. No initial fee, no recurring fee, nothing.)
  • 它是自由的。如果您需要在 QGIS 额外功能,除了傻等下一个软件版本包含此功能外,你还可以做更多:可以赞助开发某一项功能或直接自己开发它(前提是你会编程哦)。(It’s free, as in liberty. If you need extra functionality in QGIS, you can do more than just hope it will be included in the next release. You can sponsor the development of a feature, or add it yourself if you are familiar with programming.)
  • 它正在不断发展的。因为任何人都可以添加新功能和改进现有的 QGIS ,所以它从不停滞。新的工具和插件可以因为你的需要而被快速开发出来。(It’s constantly developing. Because anyone can add new features and improve on existing ones, QGIS never stagnates. The development of a new tool can happen as quickly as you need it to.)
  • 它有广泛的帮助文件和文档。如果你遇到任何问题,你可以阅读官方文档、求助于其他QGIS 用户甚至是开发人员。(Extensive help and documentation is available. If you’re stuck with anything, you can turn to the extensive documentation, your fellow QGIS users, or even the developers.)
  • 它是跨平台的。QGIS可以安装在 Mac Windows Linux 上。(Cross-platform. QGIS can be installed on MacOS, Windows and Linux.)

现在,你知道为什么要使用 QGIS了,接下来我们会告诉你如何使用。第一节课将指导你创建第一个 QGIS 地图。(Now that you know why you want to use QGIS, we can show you how. The first lesson will guide you in creating your first QGIS map.)

原作者:Linfiniti Consulting CC.   翻译:数据地图博客