9. QGIS配置

QGIS是高度可配置的。通过 设置 菜单,提供了以下不同工具:

  • styleManager 样式管理器...: 创建和管理 符号, 样式和颜色渐变.

  • customProjection 自定义投影...: 创建您自己的 坐标参照系.

  • keyboardShortcuts 键盘快捷键...: 定义您自己的一组 键盘快捷键. 此外, 工程属性 可以在每个QGIS会话期间替换它们 (可在 工程 菜单下访问).

  • interfaceCustomization 界面自定义...: 配置 应用程序界面, 隐藏您可能不需要的对话框或工具.

  • options 选项...: 设置全局 选项 以应用于软件的不同领域. 这些首选项保存在当前 用户配置 设置中, 并在使用此配置文件打开新工程时默认应用.

9.1. 选项

options 可以使用 选项 对话框选择QGIS的一些基本选项。选择菜单选项 设置 ► options 选项 , 您可以根据需要修改选项, 某些更改可能需要重新启动QGIS才能生效。

下面介绍了可以自定义选项的选项卡。

备注

插件可以在选项对话框中嵌入它们的设置

虽然以下只展示了核心设置,但请注意,通过 installed plugins 在标准选项对话框中插件可展现自己的选项,并以此扩展列表。这避免了每个插件都有自己的配置对话框,并为它们提供额外的菜单项...

9.1.1. 通用设置

../../../_images/options_general.png

图 9.1 通用设置

本地化语言环境

默认情况下,QGIS依赖于您的操作系统配置来设置语言和控制数值。启用该组允许您自定义自己的行为习惯。

  • 用户界面语言 选择要应用于GUI的语言

  • 本地化 (数字、日期和货币格式) 选择输入和呈现日期和数值的语言系统

  • checkbox 显示数字分组 (千位) 分隔符

框架底部会显示选中设置的摘要以及这些设置的作用。

应用软件

  • 选择 样式 (重启QGIS生效) , 即窗口控件在对话框中的外观和位置。可能的值取决于您的操作系统。

  • 定义 用户界面主题 (重启QGIS生效) selectString. 可以是 'default', 'Night Mapping' 或 'Blend of Gray'

  • 定义 图标大小 selectString

  • 定义 字体字号. 字体可以是 radioButtonOn Qt默认 或用户从操作系统安装的字体进行选择

  • 更改 限时信息或对话框超时

  • unchecked 启动时隐藏初始界面

  • checkbox 在欢迎页面显示QGIS动态资讯: 在欢迎页面上显示精选的QGIS动态消息,让您直接了解项目新闻 (用户/开发人员会议日期和摘要、社区调查、发布公告、各种提示...)

  • checkbox 打开QGIS软件时检查更新 如果发布了新版本,将在启动软件时检查并通知您

  • unchecked 使用操作系统颜色选择对话框 (参见 颜色选择器)

工程文件

  • 启动时打开工程为

    • '欢迎页面' (默认): 可以显示 用户配置 的动态资讯、工程模板和最近工程 (带有缩略图)。默认情况下不打开任何工程。

    • '新建': 基于默认模板打开一个新工程

    • '最近': 重新打开上次保存的工程

    • '特定': 打开一个特定的工程,使用 ... 按钮定义默认情况下要使用的工程文件。

  • checkbox 由默认工程创建新工程. 您可以选择 设置当前工程为默认工程重置为默认. 可以浏览文件并定义目录,并在其中找到用户定义的工程模板。如果您先激活 checkbox 由默认工程创建新工程, 然后将工程保存在工程模板文件夹中,这将被添加到 工程 ► 由模板新建 列表中。

  • checkbox 需要时提示保存工程和数据源更改情况 避免丢失所做的更改。

  • checkbox 移除图层时提示确认

  • checkbox 当打开旧版QGIS格式的工程文件时提出警告. 您始终可以打开使用较旧版本QGIS创建的工程,但一旦保存该工程,尝试使用较低版本打开可能会失败,这是因为该版本没有相对于高版本可用的功能。

  • 启用宏 selectString. 创建此选项是为了处理用于对工程事件执行操作的宏。您可以在 '从不'、'询问'、'仅在该会话中' 和 '始终 (不建议)' 之间进行选择。

  • Default paths: defines whether paths to files and layers used in new projects are stored as 'Absolute' or 'Relative' to the project file. This setting can be overwritten at the project level.

  • 默认工程文件格式

    • radioButtonOn QGZ:存档文件格式,嵌入辅助数据 (请参见 辅助数据)

    • radioButtonOff QGS:工程文件以明码文本保存,未嵌入辅助数据: 辅助数据存储在单独的 .qgd 文件,工程文件则在同一目录存储不同后缀名的同名文件。

9.1.2. 系统设置

SVG路径

添加或移除 可伸缩矢量图形 (SVG) 符号的搜索路径. 这些SVG文件可用于符号化、标注要素或装饰地图构图。

Also read 远程或嵌入式文件选择器 for different ways to refer to svg files in a QGIS path.

插件路径

添加或移除 附加C++插件库的搜索路径.

文档路径

添加或移除用于QGIS帮助的 文档路径 。默认情况下,会添加与所用版本对应的官方在线用户手册的链接。但是,您可以添加其他链接并从上到下排列它们的优先级:每次单击对话框中的 帮助 按钮时,都会优先检查最上面的链接,如果没有找到相应的页面,则会尝试下一个链接,依此类推。

备注

文档仅针对QGIS长期发行版 (LTR) 进行版本控制和翻译,这意味着如果您运行的是常规版本 (如QGIS 3.0),帮助按钮默认打开下一版LTR手册页面 (即3.4 LTR),其中可能包含较新版本 (3.2和3.4) 的功能描述。如果没有可用的LTR文档,则使用较新和开发版本功能描述的 测试 文档。

设置

如果进行了任何 自定义 设置,它可以帮助您 重置用户界面为默认设置 (重启QGIS生效)

环境

../../../_images/options_system.png

图 9.2 System environment variables

可以在 环境 组中查看和配置系统环境变量。这对平台很有用,例如Mac,因为GUI应用程序不一定继承用户的Shell环境,它还可以用于设置和查看由处理工具箱 (例如SAGA、GRASS) 控制的外部工具集的环境变量,以及打开源代码特定部分的调试输出。

Check checkbox Use custom variables (restart required - include separators) and you can symbologyAdd Add and symbologyRemove Remove environment variables. For each new item, you can configure a Variable name, its Value and the Apply method to use, among which:

  • Overwrite: replace any preexisting value of the variable

  • If undefined: use this value for the variable if not already defined at a higher level (e.g. OS or application levels)

  • Unset: remove the variable from the environment (the Value parameter is not used)

  • Prepend: prepend the value to the preexisting value of the variable

  • Append: append the value to the preexisting value of the variable

  • Skip: the item is kept in the list for future reference but unused

Already defined environment variables are displayed in Current environment variables, and it's possible to filter them by activating checkbox Show only QGIS-specific variables.

9.1.3. CRS and Transforms Settings

备注

有关QGIS如何处理图层投影的更多信息,请阅读 使用投影 专区。

9.1.3.1. CRS Handling

In the crs CRS Handling tab you can configure which CRS will be used for a new project or layer.

../../../_images/options_crs.png

图 9.3 CRS设置

CRS for Projects

有个选项可以自动设置新建工程的CRS:

  • radioButtonOn使用添加的第一个图层的CRS: 工程的CRS将设置为加载到其中的第一个图层的CRS

  • radioButtonOff使用默认CRS: 预选CRS将默认应用于新建工程,并在向工程添加图层时保持不变。

该选项将保存供后续QGIS会话使用,工程的坐标参照系仍然可以从 工程 ► 工程属性... ► CRS 选项卡进行重新定义。

CRS for Layers

默认图层CRS: 选择创建图层时要使用的默认CRS

还可以定义创建新图层或加载不含CRS的图层时要执行的操作。

  • radioButtonOn 保留未知CRS (无动作)

  • radioButtonOff 提示选择CRS

  • radioButtonOff 使用工程CRS

  • radioButtonOff 使用默认图层CRS

Accuracy Warnings

Only show CRS accuracy warnings for inaccuracies which exceed a given distance: occurs when you are explicitly creating or modifying a dataset and select a CRS based on a datum ensemble with lower accuracy. The default is to Always show the warning if any inaccuracy. Requires a QGIS version using at least PROJ 8.0.

unchecked Show CRS accuracy warning for layers in project legend: If checked, any layer with a CRS with accuracy issues (i.e. a dynamic crs with no coordinate epoch available, or a CRS based on a datum ensemble with inherent inaccuracy exceeding the user-set limit) will have the indicatorLowAccuracy warning icon in the Layers panel reflecting that it is a low-accuracy layer.

This is designed for use in engineering, BIM, asset management, and other fields where inaccuracies of meter/submeter level are potentially very dangerous or expensive!

unchecked Planimetric measurements: sets the default for the planimetric measurements property for newly created projects.

9.1.3.2. Coordinate Transforms

The transformation Coordinate Transforms tab helps you set coordinate transformations and operations to apply when loading a layer to a project or reprojecting a layer.

../../../_images/options_transformations.png

图 9.4 Transformations settings

Default Datum Transformations

Here you can control whether reprojecting layers to another CRS should be:

  • 使用QGIS默认变换设置自动处理;

  • 和/或更多由您通过自定义首选项控制,例如:

    • checkbox 存在多个时询问基准面变换

    • 默认情况下要应用的预定义基准变换列表。更多信息,请参阅 Datum Transformations

You can symbologyAdd Add, symbologyRemove Remove or toggleEditing Edit transformations, which will be used in any newly created project.

9.1.3.3. User Defined CRS

The customProjection User Defined CRS tab helps you to define a custom CRS which must conform to a WKT or Proj string format.

../../../_images/options_defined_crs.png

图 9.5 User Defined CRS

Set a Name and use symbologyAdd Add new CRS. If you want to delete an existing one you can use symbologyRemove Remove CRS.

Definition

  • 格式
    • WKT (Recommended)

    • Proj String (Legacy - Not Recommended)

  • Parameters
    • editCopy Copy parameters from an existing CRS.

    • Validate tests if your expression is correct.

Test

Here you can test your created CRS definition by Latitude and Longitude. Use a known coordinate to control if your definition is accurate.

9.1.4. Data Sources settings

../../../_images/options_data_sources.png

图 9.6 Data Sources settings

要素属性和表格

  • checkbox Open attribute table as docked window

  • 在其他应用程序中粘贴要素时 要素复制为 '纯文本, 无几何图形', '纯文本, WKT几何图形', 或 'GeoJSON'

  • 属性表行为 selectString: 默认打开属性表时设置过滤选项。有三种可能: '显示所有要素', '显示选中的要素' 和 '显示地图上可见的要素' 。

  • 默认视图: 定义每次打开属性表的视图模式。它可以是 '记住最后视图', '表格视图' 或 '表单视图' 。

  • 属性表记录缓存 selectNumber. 该行缓存可以保存最后加载的N个属性记录,以便更快地处理属性表。关闭属性表时,缓存将被删除。

  • 空值表示为. 在此,您可以为包含空值 (NULL) 的数据字段定义一个值。

小技巧

改进大数据属性表的打开速度

处理有大量记录的图层时,打开属性表的速度可能会很慢,因为对话框会索取图层中的所有行。将 属性表行为 设置为 显示地图可见要素 将使QGIS在打开表时仅请求当前地图画布中的要素,从而允许快速加载数据。

请注意,此属性表实例中的数据将始终关联到打开时使用的画布范围,这意味着选择 显示所有要素 将不会显示新要素。但是,您可以通过更改画布范围并在属性表选择 显示地图可见要素 选项来更新显示的要素集。

数据源处理

  • 在浏览器停靠区扫描有效项 selectString. 您可以在 '检查扩展名' 和 '检查文件内容' 之间进行选择。

  • 在浏览器停靠区扫描压缩文件 (.zip) 的内容 selectString 定义在查询此类文件时浏览器面板底部的控件信息的详细程度,'否', '基本扫描' 和 '深度扫描' 是可能的选项。

  • Prompt for sublayers when opening. Some rasters support sublayers --- they are called subdatasets in GDAL. An example is netCDF files --- if there are many netCDF variables, GDAL sees every variable as a subdataset. The option allows you to control how to deal with sublayers when a file with sublayers is opened. You have the following choices:

    • ‘始终’: 始终询问 (如果存在子图层)

    • ‘需要时’: 询问图层是否没有波段,但有子图层

    • ‘从不’: 从不提示,不会加载任何内容

    • ‘全部加载’: 从不提示,但加载所有子图层

  • checkbox Automatically refresh directories in browser dock when their contents change: Allows you to manually opt-out of monitoring directories in the Browser panel by default (eg, to avoid potential slow down due to network latency).

Localized data paths

可以对任何类型的基于文件的数据源使用本地路径,它们是用于抽象数据源位置的路径列表。例如,如果 C:\my_maps 列在本地路径中,则 C:\my_maps\my_country\ortho.tif 作为数据源的图层将在工程中保存后使用 localized:my_country\ortho.tif.

路径按优先顺序列出,换句话说,QGIS将首先在第一个路径中查找文件,然后在第二个路径中查找文件,以此类推。

Hidden browser paths

此控件列出了您在 浏览器面板 中选择隐藏的所有文件夹,从列表中移除文件夹将使其在 浏览器 面板中可用。

9.1.4.1. GDAL设置

GDAL 是一个支持大量矢量和栅格格式的地理空间数据的数据交换库。它提供了以这些格式读取和 (通常) 写入数据的驱动程序。 GDAL 选项卡显示了栅格和矢量格式的驱动程序及其功能。

GDAL raster and vector drivers

The Raster Drivers and Vector Drivers tabs allow you to define which GDAL driver is enabled to read and/or write files, as in some cases more than one GDAL driver is available.

../../../_images/options_gdal.png

图 9.7 GDAL Settings - Raster drivers

小技巧

双击允许读写访问的栅格驱动 (rw+(v)) 打开 编辑创建选项 对话框进行自定义编辑。

Raster driver options

此框架提供了自定义支持读写访问的栅格驱动程序行为的方法:

  • 编辑创建选项: 允许您编辑或添加不同的文件转换配置文件,即在输出栅格文件时使用一组预定义的参数组合 (压缩类型和层级、块大小、概述、色度、透明度…)。参数取决于驱动程序。

    ../../../_images/gdalCreateOptions.png

    图 9.8 创建选项配置文件示例 (适用于GeoTiff)

    对话框的上半部分列出了当前配置文件,并允许您添加新配置文件或删除其中任何一个。如果您更改了配置文件的默认参数,也可以将其重置为默认参数。一些驱动程序 (例如GeoTiff) 有一些可以使用的配置文件样本。

    在对话框底部:

    • symbologyAdd 按钮允许您添加行以填充参数名称和值

    • symbologyRemove 按钮删除所选参数

    • 单击 验证 按钮,检查为给定格式输入的创建选项是否有效

    • 使用 帮助 按钮查找要使用的参数,或参考 GDAL栅格驱动程序文档

  • 编辑金字塔选项

    ../../../_images/gdalPyramidsOptions.png

    图 9.9 Sample of pyramids profile

9.1.5. 渲染设置

The rendering Rendering tab provides settings for controlling layers rendering in the map canvas.

../../../_images/options_rendering.png

图 9.10 Rendering settings

Rendering Behavior

  • checkbox 默认显示地图中新添加的图层: 在加载多个图层时,取消勾选此选项会很有用,这可以避免在画布中渲染每个新图层和减慢处理过程

  • Set the Maximum cores to use for map rendering

  • The map canvas renders in the background onto a separate image and at each Map update interval (defaults to 250 ms), the content from this (off-screen) image will be taken to update the visible screen representation. However, if rendering finishes faster than this duration, it will be shown instantaneously.

  • Magnification level (see the magnifier)

Rendering Quality

  • checkbox 牺牲绘制效率使线的显示更光滑

9.1.5.1. Vector rendering settings

The polygonLayer Vector tab contains specific settings for rendering vector layers.

../../../_images/options_rendering_vector.png

图 9.11 Vector rendering settings

  • checkbox Enable Feature Simplification by Default for Newly Added Layers: you simplify features' geometry (fewer nodes) and as a result, they display more quickly. Be aware that this can cause rendering inconsistencies. Available settings are:

    • Simplification threshold (higher values result in more simplification)

    • 简化算法: 该选项会对要素进行局部 "动态 (on-the-fly)" 简化,并加快几何图形渲染速度。它不会更改从数据提供程序获取的几何图形。当您有使用要素几何图形的表达式 (例如面积计算) 时,这一点很重要 - 它确保这些计算是在原始几何图形上而不是在简化几何图形上完成的。为此,QGIS提供了三种算法: '距离' (默认)、'捕捉到网格' 和 'Visvalingam'。

    • unchecked 若可能,在数据源端简化: 几何图形由提供程序 (PostGIS、Oracle等) 进行简化,与本地简化不同,基于几何图形的计算可能会受到影响

    • Maximum scale at which the layer should be simplified (1:1 always simplifies)

    备注

    除了全局设置外,还可以从其 图层属性 ► 渲染 菜单中为任何特定图层设置要素简化

  • Curve Segmentation

    • 分割容差: 此设置控制圆弧的渲染方式。 较小的 最大角度 (两个连续顶点与曲线中心之间的角度,以度为单位) 或最大差值 (两个顶点的线段与曲线之间的距离,单位为地图单位) ,渲染时将使用 更多直线 段。

    • 容差类型: 可以是 最大角度 ,也可以是近似值和曲线之间的 最大差值

9.1.5.2. Raster rendering settings

The raster Raster tab contains specific settings for rendering raster layers.

../../../_images/options_rendering_raster.png

图 9.12 Raster rendering settings

Under Bands and Resampling:

  • 通过 RGB波段选择, 您可以定义红色、绿色和蓝色波段的编号。

  • 可以定义 放大重采样缩小重采样 方法。对于 放大重采样 您可以在三种重采样方法中选择:"最近邻插值"、"双线性" 和 "三次方"。对于:guilabel:缩小重采样 可以在 "最近邻插值" 和 "平均" 之间进行选择。您还可以设置 过采样 值 (介于0.0和99.99之间 - 较大的值意味着QGIS更大的工作量 - 默认值为2.0)。

  • checkbox Early resampling: allows to calculate the raster rendering at the provider level where the resolution of the source is known, and ensures a better zoom in rendering with QGIS custom styling. Really convenient for tile rasters loaded using an interpretation method. The option can also be set at the layer level (Symbology properties)

Contrast Enhancement options can be applied to Single band gray, Multi band color (byte/band) or Multi band color (>byte/band). For each, you can set:

  • 要使用的 算法, 其值可以是 '不拉伸', '拉伸至极小极大', '拉伸并裁剪至极小极大' 或 '裁剪到极小极大'

  • 要应用的 限制 (最小/最大值), 其值包括 '累计像素总数裁剪', '最小值/最大值', '平均 +/- 标准差'。

The Contrast Enhancement options also include:

  • 累计像素总数裁剪限制

  • 标准差乘数

9.1.6. 画布和图例设置

../../../_images/options_canvas_legend.png

图 9.13 Canvas & Legend settings

这些属性允许您设置:

  • 默认地图外观 (由工程属性覆盖): 包括 选中要素颜色背景颜色

  • 图层图例 交互操作:

    • 双击图例的操作 selectString. 您可以双击 '打开图层属性对话框', '打开属性表' 或 '打开图层样式停靠栏'。

    • unchecked Show feature count for newly added layers: displays in the Layers panel the number of features next to the layer name. Feature count of classes, if any, is as well displayed. You can right-click on a layer to turn on/off its feature count.

    • unchecked Display classification attribute names in the Layers panel, e.g. when applying a categorized or rule-based renderer (see Symbology Properties for more information).

    • WMS获取图例图形分辨率

    • 控制 图层 面板符号大小显示的 最小图例符号尺寸最大图例符号尺寸

  • 以毫秒为单位的图层 地图提示 显示 延迟

  • Whether QGIS should checkbox Respect screen DPI: If enabled, QGIS will attempt to display the canvas with physically accurate scale on screen, depending on the monitor's physical DPI. Symbology with specified display size will also be rendered accurately, e.g. a 10mm symbol will show as 10mm on screen. However, label font sizes on canvas may differ from those in QGIS' UI or other applications. If this setting is turned off, QGIS will use the operating system's logical DPI, which will be consistent with other applications on the system. However, canvas scale and symbology size may be physically inaccurate on screen. In particular, on high-dpi screens, symbology is likely to appear too small.

    For best experience, it is recommended to enable checkbox Respect screen DPI, especially when using multiple or different monitors and preparing visually high-quality maps. Disabling checkbox Respect screen DPI will generate output that may be more suitable for mapping intended for on-screen use only, especially where font sizes should match other applications.

备注

Rendering in layouts is not affected by the Respect screen DPI setting; it always respects the specified DPI for the target output device. Also note that this setting uses the physical screen DPI as reported by the operating system, which may not be accurate for all displays.

9.1.7. 地图工具设置

../../../_images/options_map_tools.png

图 9.14 Map tools settings

此选项卡提供了有关 识别工具 行为的一些选项。

  • 识别要素和显示地图提示的搜索半径 是一个容差距离,只要在该容差范围内单击,识别工具就会描述结果。

  • 突出显示颜色 允许您选择突出显示所识别要素的颜色。

  • 轮廓 确定要从识别突出显示的轮廓渲染的缓冲距离。

  • 最小宽度 决定突出显示对象轮廓的宽度。

测量工具

  • 定义测量工具的 橡皮筋颜色

  • 定义 小数位数

  • checkbox 保持基本单位 不自动转换大数目单位 (例如,米到千米)

  • 首选距离单位: 选项有 '米', '千米', '英尺, '码', '英里', '海里', '厘米', '毫米', '度' 或 '地图单位'

  • 首选面积单位: 选项有 '平方米', '平方千米', '平方英尺', '平方码', '平方英里', '公顷', '英亩', '平方海里', '平方厘米', '平方毫米', '平方度' 或 '地图单位'

  • 首选角度单位: 选项有 '度', '弧度', '百分度', '角分', '角秒', '转数/圈数 (Turns/revolutions)', 毫弧度 (SI 定义) 或 密位 (北约军用定义)

坐标和方位角显示

This section provides ways to Configure:

  • Default coordinate format for new projects, as displayed in the Coordinates box on QGIS status bar and in the Derived section of the identify Identify features tool's results

  • Default bearing format for new projects, as displayed in the status bar for the map canvas panning direction and by the measureBearing Measure bearing tool.

These options can be overridden at the project level.

平移和缩放

  • 为缩放工具或鼠标滚轮定义 缩放因子

预定义比例

Here, you find a list of predefined scales to display by default in the scale-related drop-down widgets, such as the status bar Scale, the visibility scales selector or secondary 2D map view settings,... With the symbologyAdd and symbologyRemove buttons you can add or remove your personal scales. You can also import or export scales from/to a .XML file. Note that you still have the possibility to remove your changes and reset to the predefined list.

From the project properties dialog, you can also set your own list of scales, overriding this global one in the widgets.

9.1.7.1. 数字化设置

../../../_images/options_digitizing.png

图 9.15 数字化设置

此选项卡可帮助您在 编辑矢量图层 (属性和几何图形) 时配置常规设置。

创建要素

  • checkbox 要素创建后不要弹出属性表单: 可以在每个图层属性对话框中重写此选项。

  • checkbox Reuse last entered attribute values: remember the last used value of every attribute and use it as default for the next feature being digitized. Works per layer. This behavior can also be controled on a per-field basis (see Configure the field behavior).

  • 验证几何图形. 编辑具有多个节点的复杂线和多边形可能会导致渲染速度非常慢。这是因为QGIS中的默认验证过程可能需要很多时间。要加快渲染速度,可以选择GEOS几何图形验证 (从GEOS 3.3开始) 或将其关闭。GEOS几何图形验证要快得多,但缺点是只报告第一个几何图形问题。

    请注意,根据选择,几何图形错误报告可能会有所不同 (请参阅 Types of error messages and their meanings)

  • 默认Z值 用于创建新的3D要素。

橡皮筋

  • 定义橡皮筋的 线宽, 线颜色填充颜色.

  • 编辑顶点时不更新橡皮筋.

捕捉

  • checkbox 默认启用捕捉 打开工程时激活捕捉

  • Define Default snap mode selectString ('Vertex', 'Segment', 'Centroid', 'Middle of segments', Line endpoints', 'Area')

  • 以地图单位或像素为单位定义 默认捕捉容差

  • 以地图单位或像素为单位定义 顶点编辑的搜索半径

  • 主对话框显示为 (重启QGIS生效): 设置高级捕捉对话框应显示为 "对话框" 还是 "停靠"。

  • 捕捉标记颜色

  • checkbox 显示捕捉工具提示 例如您要捕捉其要素图层的名称,当多个要素重叠时很有帮助。

  • checkbox 对不可见的要素 (未在地图画布中显示) 也启用捕捉

顶点标记

  • checkbox 仅为选中的要素显示标记

  • 定义顶点的 标记样式 selectString ('十字' (默认), '半透明圆圈' 或 '无')

  • 定义顶点的 标记尺寸 (毫米)

曲线偏移工具

接下来的3个选项是指 Advanced digitizing 中的 offsetCurve 偏移曲线 工具。通过各种设置,可以影响线偏移的形状。从 GEOS 3.3 开始可以使用这些选项。

  • 连接样式: '圆角', '尖角' 或 '斜角'

  • 相限区段

  • 尖角限制

追踪

通过激活 checkbox 将追踪转换为曲线 您可以在数字化时创建曲线段。请记住,您的数据提供程序必须支持此功能。

9.1.8. 3D settings

../../../_images/options_3d.png

图 9.16 3D settings

The 3d 3D menu helps you configure some default settings to use for any 3D Map view. These can refer to Default Camera Settings:

  • Projection type: allowing to view the 3D scene in a:

    • Perspective projection (default): Parallel lines appear to meet in the distance. Objects appear to shrink the farther they are from the camera.

    • or an Orthogonal projection: Parallel lines appear parallel. Objects appear the same size regardless of distance.

  • Camera's Field of view: only relevant in perspective projection, specifies the current vertical field of view in degrees and determines how much of the scene is visible to the camera. Default value is 45°.

  • Navigation mode: provides different means to interact with the 3D scene. Available modes are:

    • Terrain based: the camera follows around a fixed position on the surface of the terrain as the scene is navigated.

    • Walk mode (first person)

    Depending on the selected mode, navigation commands differ.

  • Movement speed

  • Invert vertical axis: Controls whether vertical axis movements should be inverted from their normal behaviour. Only affects movement in the Walk mode. It can be set to:

    • Never

    • Only when dragging: causes the vertical motion to inverted only when performing a click-and-drag camera rotation

    • and Always: causes the motions to be inverted when both click-and-dragging and when the camera movement is locked to the cursor (via a ~ key press)

9.1.9. Colors settings

../../../_images/options_colors.png

图 9.17 Colors settings

此菜单允许您在 颜色选择控件 中创建或更新整个应用程序使用的颜色调色板。您可以选择:

  • 最近使用过的颜色 显示最近使用的颜色

  • 标准颜色, 默认调色板的颜色

  • 工程颜色, 特定于当前工程的一组颜色 (更多信息,请参阅 Styles Properties )

  • 新建图层颜色, 将新图层添加到QGIS时默认使用的一组颜色

  • 或自定义调色板,您可以使用调色板组合框旁边的 ... 按钮创建或导入调色板。

默认情况下,不能移除 最近使用过的颜色, 标准颜色工程颜色 调色板,并将其设置为显示在颜色按钮下拉列表中。使用 在颜色按钮中显示 选项,还可以将自定义调色板添加到此控件中。

对于任何调色板,都可以使用框架旁边的工具组管理颜色列表,即:

  • symbologyAdd 添加symbologyRemove 移除 颜色

  • editCopy 复制editPaste 粘贴 颜色

  • fileOpen 导入fileSave 导出 颜色集从/到 .gpl 文件。

双击列表中的颜色,在 选择颜色 对话框中对其进行调整或替换,也可以通过双击 标注 列对其进行重命名。

9.1.10. Fonts Settings

../../../_images/options_fonts.png

图 9.18 Fonts settings

The Fonts tab provides support to manage fonts used across the projects:

  • Font Replacements: gives ability to populate a list of automatic font replacements to apply when loading projects or styles, allowing better support for projects and styles to be used across different operating systems (e.g. replace "Arial" with "Helvetica").

  • User Fonts: Allows you to place TTF or OTF fonts in the fonts sub-folder of the user profile. These fonts can be automatically loaded at QGIS startup time. This provides a way to use fonts without requiring them to be installed on an operating system level, which is often blocked in enterprise environments. The panel lists all installed user fonts and allows you to manage (i.e. remove) previously installed user fonts.

    It is also possible to checkbox Automatically download missing, freely-licensed fonts: E.g. if you open a project or style, or try to load a vector tile layer that references fonts that aren’t currently available, then a hard-coded list of freely licensed fonts to download via URL is consulted to determine whether it’s possible to automatically download the font to the user profile font directory (with notification of the font license).

9.1.11. Layouts settings

../../../_images/options_layouts.png

图 9.19 Layouts settings

缺省布局

您可以定义在 打印布局 中使用的 默认字体

网格外观

  • Define the Grid style ('Solid', 'Dots', 'Crosses')

  • 定义 网格颜色

网格和参考线默认值

  • Define the Grid spacing

  • Define the Grid offset for X and Y

  • Define the Snap tolerance

布局路径

  • 定义 附加打印模板的搜索路径: 包含自定义布局模板的文件夹列表,可在创建新模板时使用。

9.1.12. Variables settings

变量 选项卡列出了全局级别的所有可用变量。

它还允许用户管理全局级别的变量。单击 symbologyAdd 按钮添加新的自定义全局级别变量;同样,从列表中选择一个自定义全局级别变量,然后单击 symbologyRemove 按钮将其删除。

有关变量的更多信息,请参见 将值存储在变量中 章节。

../../../_images/options_variables_global.png

图 9.20 Variables settings

9.1.13. Authentication settings

认证 选项卡中,可以设置认证配置和管理PKI证书。更多信息,请参阅 认证系统

To manage authentications, you can use the list of tools next to the frame, ie:

  • symbologyAdd Add new authentication configuration

  • symbologyRemove Remove selected authentication configuration

  • symbologyEdit Edit selected authentication configuration

../../../_images/auth-editor-configs2.png

图 9.21 Authentication settings

9.1.14. Network settings

通用

  • 定义 网络请求超时 (毫秒) - 默认是 60000

  • 定义 WMS功能描述的默认有效期 (小时) - 默认是 24

  • 定义 WMS-C/WMTS瓦片的默认过期时间 (小时) - 默认是 24

  • 定义 瓦片或要素请求遇到错误时的最大重试次数

  • 定义 用户代理

../../../_images/options_network.png

图 9.22 Network and proxy settings

缓存设置

定义缓存的 目录大小, 还提供了 发生SSL错误时自动清除连接认证缓存 (推荐) 的工具。

Web访问代理

  • checkbox Web访问使用代理

  • 根据需要设置 代理类型 selectString, 并定义 "主机" 和 "端口"。可用的代理类型包括:

    • 默认代理: 代理根据系统的代理确定

    • Socks5Proxy: 任何类型连接的通用代理,支持TCP、UDP、绑定到端口 (传入连接) 和认证。

    • HttpProxy: 使用 "CONNECT" 命令实现,只支持传出TCP连接;支持认证。

    • HttpCachingProxy: 使用普通的HTTP命令实现,仅在HTTP请求的上下文中有用。

    • FtpCachingProxy: 使用FTP代理实现,仅在FTP请求的上下文中有用。

使用 认证控件 设置代理的凭据。

排除部分URL可以添加到代理设置下方的文本框中 (请参阅 图 9.22). 如果目标URL以此文本框中列出的字符串之一开头,则不会使用代理。

If you need more detailed information about the different proxy settings, please refer to the manual of the underlying QT library documentation at https://doc.qt.io/archives/qt-5.9/qnetworkproxy.html#ProxyType-enum

小技巧

使用代理

使用代理有时会很棘手,通过对上述代理类型进行 "反复试验" 来检查它们在您的实例中是否成功,是很必要的。

9.1.15. GPS settings

9.1.15.1. GPS Visualisation Options

../../../_images/options_gps.png

图 9.23 GPS settings

This dialog helps you configure GPS devices display when connected to QGIS:

  • GPS location marker for controlling the marker symbol used for the current GPS location

  • Rotate to match GPS bearing: whether the marker symbol should be rotated to match the GPS direction

9.1.15.2. GPSBabel

GPSBabel converts waypoints, tracks, and routes between popular GPS receivers such as Garmin or Magellan and mapping programs like Google Earth or Basecamp. Literally hundreds of GPS receivers and programs are supported. QGIS relies on GPSBabel to interact with these devices and manipulate their data.

  1. First you have to define the Path to GPSBabel binaries.

  2. Then you may want to add your device. You can update devices list using symbologyAdd Add new device or symbologyRemove Remove device button.

  3. For each device:

    • you provide a Device name

    • you configure different Commands QGIS will use while interacting with it, such as:

      • Waypoint download from the device

      • Waypoint upload to the device

      • Route download from the device

      • Route upload to the device

      • Track download from the device

      • Track upload to the device

      While the commands are usually GPSBabel commands, you can also use any other command line program that can create a GPX file. QGIS will replace the keywords %type, %in, and %out when it runs the command.

      As an example, if you create a device type with the download command gpsbabel %type -i garmin -o gpx %in %out and then use it to download waypoints from port /dev/ttyS0 to the file output.gpx, QGIS will replace the keywords and run the command gpsbabel -w -i garmin -o gpx /dev/ttyS0 output.gpx.

      Read the GPSBabel manual for the command line options that may be specific to your use case.

Once you have created a new device type, it will appear in the device lists for the GPS download and upload algorithms.

../../../_images/options_gpsbabel.png

图 9.24 GPS Babel settings

9.1.16. Locator settings

search The 搜索 选项卡允许您配置 搜索栏, 这是状态栏上的一个快速搜索控件,可帮助您在应用程序中执行搜索。它提供了一些默认过滤 (带有前缀) 供使用:

../../../_images/options_locator.png

图 9.25 Locator settings

  • Project Layers (l): finds and selects a layer in the Layers panel.

  • Project Layouts (pl): finds and opens a print layout.

  • 动作 (.): 查找并执行QGIS动作;动作可以是QGIS中的任何工具或菜单、打开面板...

  • Active Layer Features (f): searches for matching attributes in any field from the current active layer and zooms to the selected feature. Press settings to configure the maximum number of results.

  • Features in All Layers (af): searches for matching attributes in the display name of each searchable layers and zooms to the selected feature. Press settings to configure the maximum number of results and the maximum number of results per layer.

  • Calculator (=): allows evaluation of any QGIS expression and, if valid, gives an option to copy the result to the clipboard.

  • Spatial Bookmarks (b): finds and zooms to the bookmark extent.

  • Settings (set): browses and opens project and application-wide properties dialogs.

  • Go to Coordinate (go): pans the map canvas to a location defined by a comma or space separated pair of x and y coordinates or a formatted URL (e.g., OpenStreetMap, Leaflet, OpenLayer, Google Maps, ...). The coordinate is expected in WGS 84 (epsg:4326) and/or map canvas CRS.

  • Nominatim Geocoder (>): geocodes using the Nominatim geocoding service of the OpenStreetMap Foundation.

  • Processing Algorithms (a): searches and opens a Processing algorithm dialog.

  • Edit Selected Features (ef): gives quick access and runs a compatible modify-in-place Processing algorithm on the active layer.

在对话框中,您可以:

  • 自定义过滤 前缀, 即用于触发过滤的关键字

  • 设置是否 启用 过滤:可以在搜索中使用过滤,并在搜索栏菜单中提供快捷键

  • 设置过滤是否为 默认: 不使用过滤的搜索只返回默认过滤类别的结果。

  • 一些过滤提供了配置搜索结果数量的方法。

默认搜索过滤集可以通过插件进行扩展,例如用于 OSM Nominatim 搜索、直接数据库搜索、图层目录搜索等

9.1.17. Acceleration settings

OpenCL加速设置。

../../../_images/options_acceleration.png

图 9.26 Acceleration settings

根据您的硬件和软件情况,可能需要安装其他库来启用OpenCL加速。

9.1.18. IDE settings

9.1.18.1. Code Editor settings

codeEditor 代码编辑器 选项卡,可以控制代码编辑器控件 (Python交互式控制台和编辑器、表达式控件和函数编辑器等) 的外观和行为。

../../../_images/options_codeeditor.png

图 9.27 Code Editor settings

在对话框顶部,控件以各种编码语言 (Python, QGIS表达式, HTML, SQL, JavaScript) 提供当前设置的实时预览。调整设置的个性化方法如下:

  • Check unchecked Override Code Editor Font to modify the default Font family and Size.

  • 颜色 组下,您可以:

    • 选择 颜色方案: 预定义方案的设置为 默认, 曝光暗曝光亮 。一旦修改颜色,就会触发 自定义 方案,并且可以通过选择预定义方案进行重置。

    • 在编写代码时更改每个元素的 颜色, 例如用于注释、引号、函数、背景等的颜色。

9.1.18.2. Python Console settings

runConsole Python控制台 设置可帮助您管理和控制Python编辑器 (交互式控制台, 代码编辑器, 工程宏, 自定义表达式, ...) 的行为,也可以使用以下 options 选项... 按钮进行访问:

  • Python控制台 工具栏

  • Python控制台 控件的上下文菜单

  • 以及代码编辑器的上下文菜单。

../../../_images/options_pythonconsole.png

图 9.28 Python Console settings

您可以指定:

  • unchecked 自动补全: 启用代码自动完成。您可以从当前文档、已安装的API文件或两者中获取自动补全阈值。

    • 自动补全阈值: 设置显示自动补全列表的阈值 (以字符为单位)

  • 键盘输入 下面

    • unchecked 自动插入括号: 启用括号的自动关闭功能

    • checkbox 遇到 'from xxx' 字符串时自动插入 'import': 在指定导入时允许插入 'import' 字符

  • 运行和调试 下面

    • unchecked Enable Object Inspector (switching between tabs may be slow)

    • unchecked 运行之前自动保存的脚本: 执行时自动保存脚本。此操作将储存一个临时文件 (在临时系统目录中),该文件将在运行后自动删除。

对于 API 您可以指定:

  • checkbox 使用预加载的API文件: 您可以选择是否要使用预加载的API文件。如果未勾选此选项,可以添加API文件,还可以选择是否使用准备好的API文件 (请参见下一选项)。

  • unchecked 使用预备的API文件: 如果勾选,所选 *.pap 文件将用于代码完成。要生成预备的API文件,必须至少加载一个 *.api 文件,然后通过单击 编译API... 按钮对其进行编译。

Under GitHub access token, you can generate a personal token allowing you to share code snippets from within the Python code editor. More details on GitHub authentication

9.1.19. Processing settings

processingAlgorithm 数据处理 选项卡为您提供QGIS处理框架中使用的工具和数据提供程序的常规设置。更多信息请访问 QGIS处理架构

../../../_images/options_processing.png

图 9.29 Processing settings

9.1.20. Advanced settings

../../../_images/options_advanced.png

图 9.30 Advanced settings

所有与QGIS相关的设置 (UI、工具、数据提供程序、处理配置、默认值和路径、插件选项、表达式、几何图形检查…) 都保存在当前 用户配置 目录下的 QGIS/QGIS3.ini 文件中。通过将此文件复制到其他设备,可以共享配置。

在QGIS中, 高级 选项卡提供了通过 高级设置编辑器 管理这些设置的方法。在您保证要小心之后,这个控件将被一个包含所有现有设置的树所填充,您可以编辑它们的值。右键单击设置或组,可以将其删除 (要添加设置或组,必须编辑 QGIS3.ini 文件)。所做更改会自动保存在 QGIS3.ini 文件中。

警告

避免盲目使用高级选项卡设置

鉴于更改会自动应用,因此修改此对话框中的项时一定要小心。在不知情的情况下进行更改可能会以各种方式破坏QGIS设置。

9.2. 使用用户配置文件

设置 ► 用户配置 菜单提供设置和访问用户配置文件的功能。用户配置文件是统一的应用程序配置,允许在单个文件夹中储存:

  • 所有 全局设置, 包括语言环境、投影、认证设置、调色板、快捷键等

  • GUI配置和 定制

  • 为基准变换而安装的网格文件和其他Proj辅助文件

  • 已安装的 插件 及其配置

  • 工程模板和保存工程的历史记录及其图像预览

  • 数据处理设置 、日志、脚本和模型。

默认情况下,QGIS安装包含一个名为 default 的单用户配置文件夹。但您可以创建任意数量的用户配置文件夹:

  1. 单击 新建配置... 条目。

  2. 系统将提示您提供配置文件名,并在 ~/<UserProfiles>/ 下创建同名文件夹,其中:

    • ~ represents the HOME directory, which on win Windows is usually something like C:\Users\<username>.

    • <UserProfiles> 表示主配置文件夹,即:

      • nix .local/share/QGIS/QGIS3/profiles/

      • win %AppData%\Roaming\QGIS\QGIS3\profiles\

      • osx Library/Application Support/QGIS/QGIS3/profiles/

    可以使用 打开当前配置文件夹 从QGIS打开用户配置文件夹。

  3. 使用原始的配置启动QGIS新实例,之后您可以设置自定义配置。

如果您的QGIS设置中有多个配置文件,当前配置文件的名称将显示在应用程序标题栏的方括号之间。

由于每位用户配置文件都包含独立的设置、插件和历史记录,因此非常适合不同的工作流、演示、同一台计算机的用户或测试设置等。您可以通过 设置 ► 用户配置 菜单,或从 命令行 使用特定用户的配置文件运行QGIS。

除非更改,否则最后关闭QGIS会话的配置文件将用于之后的QGIS会话。

小技巧

在新用户配置文件下运行QGIS,以检查Bug的持久性

当您在QGIS遇到某些功能有奇怪的行为时,请创建一个新的用户配置文件,然后再次运行这些命令。有时,Bug与当前用户配置文件中的一些遗留问题有关,创建一个新用户配置文件可能会进行修复,因为现在使用新的 (原始) 配置文件重新启动QGIS。

9.3. 工程属性

工程 ► 工程属性 下的工程属性窗口中,可以设置工程特定的选项。特定于工程的选项将重写上述 选项 对话框中的等效选项。

9.3.1. 通用属性

In the general General tab, the General settings let you:

  • 查看工程文件的位置

  • set the folder for the project home (available in the Project home item of the Browser panel). The path can be relative to the folder of the project file (type it in) or absolute. The project home can be used for storing data and other content that is useful for the project. Convenient when dataset and project files are not stored at the same place. If not filled, the Project home defaults to the project file folder.

  • 在工程文件路径旁边指定工程的标题

  • 选择要素被选中时要使用的颜色

  • 选择背景色:用于地图画布的颜色

  • 设置工程中图层的路径应保存为绝对 (完整) 还是相对于工程文件位置。当图层和工程文件都可以移动或共享,或从不同平台的计算机访问工程时,您可能更喜欢相对路径。

  • 选择在工程渲染为地图瓦片时避免伪影。请注意,勾选此选项可能会导致性能下降。

  • Remember attribute tables windows and docks between sessions: If checked for a project, then any opened attribute tables will be saved into the project and immediately restored when loading that project. This can improve workflows when you constructed a project with a particular set of attribute table configurations for your requirements, and re-setting up these attribute tables is a hassle.

计算面积和距离是GIS中的常见需求。但是,这些值实际与基础投影设置有关。 计量 框架允许您控制这些参数,您可以选择:

  • 椭球体, 距离和面积的计算完全基于此,可以是:

    • None/Planimetric: returned values are in this case cartesian measurements. This option can be set as default for new projects from the Settings ► options Options ► crs CRS Handling menu

    • 自定义 : 您需要设置长半轴和短半轴的值。

    • 或预定义列表中的现有椭球体 (Clarke 1866, Clarke 1880 IGN, New International 1967, WGS 84...)。

  • 长度和周长的 距离计量单位面积计量单位 。这些设置默认为QGIS选项中设置的单位,但随后会重写当前工程中的单位,用于:

    • 属性表字段更新栏

    • 字段计算器的计算

    • 识别工具得到的长度、周长和面积值

    • 测量对话框显示的默认单位

The Coordinate and Bearing display allows you to customize the display of:

  • the coordinates shown in the Coordinates box on QGIS status bar and in the Derived section of the identify Identify features tool's results

  • the bearing value displayed in the status bar for the map canvas panning direction and by the measureBearing Measure bearing tool.

Available parameters are:

  • Display coordinates using either:

    • Map Units, based on the project CRS

    • Map Geographic (degrees): based on the project CRS if it is of geographic type, otherwise uses its associated geographic CRS. This is helpful e.g. for non-earth celestial bodies.

    • or Custom Projection Units: allows to rely on any CRS you desire for coordinates display

  • In the Coordinate CRS option, you can view or define the CRS to use depending on your display mode.

  • Coordinate format: you can configure it as Decimal Degrees, Degrees, Minutes or Degrees, Minutes, Seconds, and whether it should display:

    • unchecked Show directional suffix

    • unchecked Show leading zeros for minutes and seconds

    • unchecked Show leading zeros for degrees

    • unchecked 显示尾随零

  • Coordinate precision: the number of decimal places can be automatic (derived from the type of CRS) or set manually

  • Coordinate order: you can opt to display the coordinates in the native order of the CRS (Default) or switch it to either Easting, Northing (Longitude, Latitude) or Northing, Easting (Latitude, Longitude) order

  • Bearing format possible values are 0 to 180°, with E/W suffix, -180 to +180° or 0 to 360°. The number of Decimal places as well as whether to Show trailing zeros can be set.

../../../_images/project_general.png

图 9.31 工程属性对话框的通用选项卡

9.3.2. 元数据属性

The editMetadata Metadata tab allows detailed metadata to be defined, including (among the others): author, creation date, language, abstracts, categories, keywords, contact details, links, history. There is also a validation functionality that checks if specific fields were filled, anyway this is not enforced. See vector layer metadata properties for some details.

9.3.3. View Settings

../../../_images/project_viewsettings.png

图 9.32 View Settings tab of the Project Properties dialog

The overlay View Settings tab provides means to control the project map canvas. You can:

  • set Project predefined scales: the list of scales to display in scale-related drop-down widgets, such as the status bar Scale, the visibility scales selector or secondary 2D map view settings,... in replacement of the global predefined scales.

  • Set Project full Extent: this extent will be used instead of the extent of all layers when zooming to full map extent (zoomFullExtent). It's useful when a project contains web layers/national layers/global layers yet the actual area of interest for the project is a smaller geographic area. The project full extent coordinates can be set with the extent selector widget.

9.3.4. CRS属性

备注

有关QGIS如何处理工程投影的更多信息,请阅读 使用投影 专用章节。

crs CRS 选项卡可帮助您设置要在此工程中使用的坐标参照系。它可以是:

  • checkbox 无CRS (或未知/非地球投影): 图层是根据其原始坐标绘制的

  • 或者现有坐标参照系,可以是 地理, 投影用户自定义 。添加到工程中的图层会动态转换到此CRS,以便叠加它们,而不考虑其原始CRS。

9.3.5. 变换属性

transformation 变换 选项卡通过配置要应用于当前工程的基准面变换首选项,帮助您控制图层重投影设置。照例,这些设置会覆盖任何相应的全局设置。更多信息,请参阅 Datum Transformations

9.3.6. Styles Properties

Under symbology Styles tab, you can configure symbols and colors inherent to the project, allowing to safely share the project among different machines.

The Default Symbols group lets you control how new layers will be drawn in the project when they do not have an existing .qml style defined. You can set Marker, Line, Fill to apply depending on the layer geometry type as well as default Color Ramp and Text Format (e.g. when enabling labeling). Any of these items can be reset using the Clear entry from the corresponding drop-down widget.

In the Options group, you can:

  • 将默认 不透明度 应用于新建图层

  • checkbox 给符号指派随机颜色, 修改符号填充颜色,从而避免对所有图层进行相同的渲染。

../../../_images/project_styles.png

图 9.33 Styles tab

还有附加部件,您可以在其中为正在运行的工程定义指定的颜色。与 全局颜色 一样,您可以:

  • symbologyAdd 添加symbologyRemove 移除 颜色

  • editCopy 复制editPaste 粘贴 颜色

  • fileOpen 导入fileSave 导出 颜色集从/到 .gpl 文件。

双击列表中的颜色,在 选择颜色 对话框中对其进行调整或替换,也可以通过双击 标注 列对其进行重命名。

这些颜色被认定为 工程颜色 ,并作为 颜色控件 的一部分列出。

小技巧

使用工程颜色快速分配和更新颜色控件

工程颜色可以使用其标注来引用,并且所使用的颜色控件与之绑定。这意味着您不必为许多属性设置相同的颜色而重复替换,为了避免繁琐的更新,您可以:

  1. 将颜色定义为工程颜色

  2. 单击要设置颜色属性旁边的 数据定义重写控件

  3. 将鼠标悬停在 颜色 菜单上并选择工程颜色。然后,属性被指定表达式 project_color('color_label') ,颜色控件反映该颜色。

  4. 根据需要重复步骤 2 和 3

  5. 每次更新工程颜色,所做的更改就会反映在使用工程颜色的任何地方。

9.3.7. 数据源属性

In the openTable Data Sources tab, you can:

  • Transaction mode: define how edits are sent to the data provider```

    • Local Edit Buffer: edits are buffered locally and sent to the provider when toggling layer editing mode or clicking Save edits.

    • Automatic Transaction Groups: on supported datasources (postgres and geopackage databases) the edit state of all tables that originate from the same database are synchronized and executed in a server side transaction. Also, instead of buffering edit changes locally, they are directly sent to a transaction in the database which gets committed when toggling layer editing mode or clicking Save edits.

    • Buffered Transaction Groups: all editable layers, disregarding from which provider, are toggled synchronously and all edits are saved in a local edit buffer. Saving changes is executed within a single transaction on all layers (per provider).

    Note that you can change this option only if no layer is being edited in the project.

  • unchecked Evaluate default values on provider side: When adding new features in a PostgreSQL table, fields with default value constraint are evaluated and populated at the form opening, and not at the commit moment. This means that instead of an expression like nextval('serial'), the field in the Add Feature form will display expected value (e.g., 25).

  • unchecked Remember editable layer status between sessions: makes sure that all layers that are editable in a project will be remembered as such when saving the project, as well as making sure that those layers are immediately made editable whenever the project is restored.

  • Configure the Layers Capabilities, i.e.:

    • Set (or disable) which layers are identifiable, i.e. will respond to the identify tool. By default, layers are set queryable.

    • Set whether a layer should appear as read-only, meaning that it can not be edited by the user, regardless of the data provider's capabilities. Although this is a weak protection, it remains a quick and handy configuration to avoid end-users modifying data when working with file-based layers.

    • Define which layers are searchable, i.e. could be queried using the locator widget. By default, layers are set searchable.

    • Define which layers are defined as required. Checked layers in this list are protected from inadvertent removal from the project.

    • Define which layers are private, i.e. hidden from the Layers panel. This is meant for accessory layers (basemap, join, lookups for value-relations, most probably aspatial layers, ...) that you still need in a project but you don't want them to pollute the legend tree and other layer selection tools. If set visible, they are still displayed in the map canvas and rendered in the print layout legend. Use the filterMap Filter legend ► Show private layers option in the Layers panel top toolbar to temporarily turned them on for any interaction.

    The Layers Capabilities table provides some convenient tools to:

    • Select multiple cells and press Toggle Selection to have them change their checkbox state;

    • unchecked Show spatial layers only, filtering out non-spatial layers from the layers list;

    • search Filter layers... and quickly find a particular layer to configure.

  • Under the Advanced Settings group, you can select unchecked Trust project when data source has no metadata: To speed up project loading by skipping data checks. Useful in QGIS Server context or in projects with huge database views/materialized views. The extent of layers will be read from the QGIS project file (instead of data sources) and when using the PostgreSQL provider the primary key unicity will not be checked for views and materialized views.

../../../_images/project_datasources.png

图 9.34 Data Sources tab

9.3.8. Relations Properties

The relations Relations tab is used to define 1:n relations and polymorphic relations. The relations are defined in the project properties dialog. Once relations exist for a layer, a new user interface element in the form view (e.g. when identifying a feature and opening its form) will list the related entities. This provides a powerful way to express e.g. the inspection history on a length of pipeline or road segment. You can find out more about 1:n relations support in Section Creating one or many to many relations.

../../../_images/project_relations.png

图 9.35 Relations tab

9.3.9. Variables Properties

The expression Variables tab lists all the variables available at the project's level (which includes all global variables). Besides, it also allows the user to manage project-level variables. Click the symbologyAdd button to add a new custom project-level variable. Likewise, select a custom project-level variable from the list and click the symbologyRemove button to remove it. More information on variables usage in the General Tools 将值存储在变量中 section.

9.3.10. Macros Properties

The action Macros tab is used to edit Python macros for projects. Currently, only three macros are available: openProject(), saveProject() and closeProject().

../../../_images/macro.png

图 9.36 Macro settings

9.3.11. QGIS Server Properties

The overlay QGIS Server tab allows you to configure your project in order to publish it online. Here you can define information about the QGIS Server WMS and WFS capabilities, extent and CRS restrictions. More information available in section Configure your project and subsequent.

../../../_images/project_qgis_server.png

图 9.37 QGIS Server settings

9.3.12. Temporal Properties

The temporal Temporal tab is used to set the temporal range of your project, either by using manual Start date and End date inputs or by calculating it from the current project temporal layers. The project time range can then be used in the Temporal controller panel to manage the map canvas temporal navigation.

../../../_images/project_temporal.png

图 9.38 Project Temporal tab

9.3.13. Terrain Properties

The layoutItem3DMap Terrain tab helps you configure default settings for the terrain and elevation. When any new 3d map is created in the project, the map will default to using the same terrain settings as are defined for the project. The project elevation settings will also be respected by the Profile tool.

../../../_images/project_terrain.png

图 9.39 Project Terrain tab

Terrain and elevation options are available for:

  • Flat terrain with Terrain height setting

  • DEM (Raster Layer): with setting for defining the Raster layer, a Vertical scale factor to apply to band values and a vertical Offset

  • Mesh: with setting for defining the Mesh layer, a Vertical scale factor to apply to vertices Z value and a vertical Offset

These settings can be overwritten from the 3D map configuration dialog.

9.4. Customization

The Customization dialog lets you (de)activate almost every element in the QGIS user interface. This can be very useful if you want to provide your end-users with a 'light' version of QGIS, containing only the icons, menus or panels they need.

备注

Before your changes are applied, you need to restart QGIS.

../../../_images/customization.png

图 9.40 The Customization dialog

Ticking the checkbox Enable customization checkbox is the first step on the way to QGIS customization. This enables the toolbar and the widget panel from which you can uncheck and thus disable some GUI items.

The configurable item can be:

  • a Menu or some of its sub-menus from the 菜单栏

  • a whole Panel (see 面板和工具栏)

  • the Status bar described in 状态栏 or some of its items

  • a Toolbar: the whole bar or some of its icons

  • or any widget from any dialog in QGIS: label, button, combobox...

With select Switch to catching widgets in main application, you can click on an item in QGIS interface that you want to be hidden and QGIS automatically unchecks the corresponding entry in the Customization dialog. You can also use the Search box to find items by their name or label.

Once you setup your configuration, click Apply or OK to validate your changes. This configuration becomes the one used by default by QGIS at the next startup.

The modifications can also be saved in a .ini file using fileSave Save To File button. This is a handy way to share a common QGIS interface among multiple users. Just click on fileOpen Load from File from the destination computer in order to import the .ini file. You can also run command line tools and save various setups for different use cases as well.

小技巧

Easily restore predefined QGIS

The initial QGIS GUI configuration can be restored by one of the methods below:

  • unchecking checkbox Enable customization option in the Customization dialog or click the selectAllTree Check All button

  • pressing the Reset button in the Settings frame under Settings ► Options menu, System tab

  • launching QGIS at a command prompt with the following command line qgis --nocustomization

  • setting to false the value of UI ► Customization ► Enabled variable under Settings ► Options menu, Advanced tab (see the warning).

In most cases, you need to restart QGIS in order to have the change applied.

9.5. Keyboard shortcuts

QGIS provides default keyboard shortcuts for many features. You can find them in section 菜单栏. Additionally, the menu option Settings ► keyboardShortcuts Keyboard Shortcuts... allows you to change the default keyboard shortcuts and add new ones to QGIS features.

../../../_images/shortcuts.png

图 9.41 Define shortcut options

Configuration is very simple. Use the search box at the top of the dialog to find a particular action, select it from the list and click on :

  • Change and press the new combination you want to assign as new shortcut

  • Set None to clear any assigned shortcut

  • or Set Default to backup the shortcut to its original and default value.

Proceed as above for any other tools you wish to customize. Once you have finished your configuration, simply Close the dialog to have your changes applied. You can also Save the changes either as an .XML file with only the User Shortcuts or with all Shortcuts or as an .PDF file with all Shortcuts and Load them into another QGIS installation.

9.6. Running QGIS with advanced settings

9.6.1. Command line and environment variables

We've seen that launching QGIS is done as for any application on your OS. QGIS provides command line options for more advanced use cases (in some cases you can use an environment variable instead of the command line option). To get a list of the options, enter qgis --help on the command line, which returns:

QGIS is a user friendly Open Source Geographic Information System.
Usage: /usr/bin/qgis.bin [OPTION] [FILE]
  OPTION:
        [-v, --version]     display version information and exit
        [-s, --snapshot filename]   emit snapshot of loaded datasets to given file
        [-w, --width width] width of snapshot to emit
        [-h, --height height]       height of snapshot to emit
        [-l, --lang language]       use language for interface text (changes existing override)
        [-p, --project projectfile] load the given QGIS project
        [-e, --extent xmin,ymin,xmax,ymax]  set initial map extent
        [-n, --nologo]      hide splash screen
        [-V, --noversioncheck]      don't check for new version of QGIS at startup
        [-P, --noplugins]   don't restore plugins on startup
        [-B, --skipbadlayers]     don't prompt for missing layers
        [-C, --nocustomization]     don't apply GUI customization
        [-z, --customizationfile path]      use the given ini file as GUI customization
        [-g, --globalsettingsfile path]     use the given ini file as Global Settings (defaults)
        [-a, --authdbdirectory path] use the given directory for authentication database
        [-f, --code path]   run the given python file on load
        [-d, --defaultui]   start by resetting user ui settings to default
        [--hide-browser]        hide the browser widget
        [--dxf-export filename.dxf]     emit dxf output of loaded datasets to given file
        [--dxf-extent xmin,ymin,xmax,ymax]      set extent to export to dxf
        [--dxf-symbology-mode none|symbollayer|feature] symbology mode for dxf output
        [--dxf-scale-denom scale]       scale for dxf output
        [--dxf-encoding encoding]       encoding to use for dxf output
        [--dxf-map-theme maptheme]      map theme to use for dxf output
        [--take-screenshots output_path]        take screen shots for the user documentation
        [--screenshots-categories categories]   specify the categories of screenshot to be used (see QgsAppScreenShots::Categories).
        [--profile name]        load a named profile from the user's profiles folder.
        [-S, --profiles-path path]  path to store user profile folders. Will create profiles inside a {path}\profiles folder
        [--version-migration]   force the settings migration from older version if found
        [--openclprogramfolder]         path to the folder containing the sources for OpenCL programs.
        [--help]                this text
        [--]            treat all following arguments as FILEs

  FILE:
    Files specified on the command line can include rasters,
    vectors, and QGIS project files (.qgs and .qgz):
     1. Rasters - supported formats include GeoTiff, DEM
        and others supported by GDAL
     2. Vectors - supported formats include ESRI Shapefiles
        and others supported by OGR and PostgreSQL layers using
        the PostGIS extension

小技巧

Example Using command line arguments

You can start QGIS by specifying one or more data files on the command line. For example, assuming you are in the qgis_sample_data directory, you could start QGIS with a vector layer and a raster file set to load on startup using the following command: qgis ./raster/landcover.img ./gml/lakes.gml

9.6.1.1. --version

This option returns QGIS version information.

9.6.1.2. --snapshot

This option allows you to create a snapshot in PNG format from the current view. This comes in handy when you have many projects and want to generate snapshots from your data, or when you need to create snapshots of the same project with updated data.

Currently, it generates a PNG file with 800x600 pixels. The size can be adjusted using the --width and --height arguments. The filename can be added after --snapshot. For example:

qgis --snapshot my_image.png --width 1000 --height 600 --project my_project.qgs

9.6.1.3. --width

This option returns the width of the snapshot to be emitted (used with --snapshot).

9.6.1.4. --height

This option returns the height of the snapshot to be emitted (used with --snapshot).

9.6.1.5. --lang

Based on your locale, QGIS selects the correct localization. If you would like to change your language, you can specify a language code. For example, qgis --lang it starts QGIS in Italian localization.

9.6.1.6. --project

Starting QGIS with an existing project file is also possible. Just add the command line option --project followed by your project name and QGIS will open with all layers in the given file loaded.

9.6.1.7. --extent

To start with a specific map extent use this option. You need to add the bounding box of your extent in the following order separated by a comma:

--extent xmin,ymin,xmax,ymax

This option probably makes more sense when paired with the --project option to open a specific project at the desired extent.

9.6.1.9. --noversioncheck

Skip searching for a new version of QGIS at startup.

9.6.1.10. --noplugins

If you have trouble at start-up with plugins, you can avoid loading them at start-up with this option. They will still be available from the Plugins Manager afterwards.

9.6.1.11. --nocustomization

Using this option, any existing GUI customization will not be applied at startup. This means that any hidden buttons, menu items, toolbars, and so on, will show up on QGIS start up. This is not a permanent change. The customization will be applied again if QGIS is launched without this option.

This option is useful for temporarily allowing access to tools that have been removed by customization.

9.6.1.12. --skipbadlayers

Using this option, you can avoid QGIS prompting the Handle Unavailable Layers dialog at startup. The project file is loaded, with missing layers kept as unavailable. More details on the topic at 处理损坏的文件路径.

9.6.1.13. --customizationfile

Using this option, you can define a UI customization file, that will be used at startup.

9.6.1.14. --globalsettingsfile

The equivalent environment variable is QGIS_GLOBAL_SETTINGS_FILE.

Using this option, you can specify the path for a Global Settings file (.ini), also known as the Default Settings. The settings in the specified file replace the original inline default ones, but the user profiles' settings will be set on top of those.

QGIS looks for the default global settings file in the following order and only the first found file will be used:

  • path specified by the commandline parameter

  • path defined by the environment variable

  • the AppDataLocation folder, where persistent application data can be stored; it is managed by the user or system administrator and is not touched by installer and does not require any additional setup like passing commandline parameters or settings environment variable. Depending on the OS, it is:

    • nix $HOME/.local/share/QGIS/QGIS3/

    • win C:\Users\<username>\%AppData%\Roaming\QGIS\QGIS3\

    • osx $HOME/Library/Application Support/QGIS/QGIS3/

  • the installation directory, i.e. your_QGIS_package_path/resources/qgis_global_settings.ini.

Presently, there's no way to specify a file to write settings to; therefore, you can create a copy of an original settings file, rename, and adapt it.

Setting the qgis_global_setting.ini file path to a network shared folder, allows a system administrator to change global settings and defaults in several machines by only editing one file.

9.6.1.15. --authdbdirectory

This option is similar to --globalsettingsfile, but defines the path to the directory where the authentication database will be stored and loaded.

9.6.1.16. --code

This option can be used to run a given python file directly after QGIS has started.

For example, when you have a python file named load_alaska.py with following content:

from qgis.utils import iface
raster_file = "/home/gisadmin/Documents/qgis_sample_data/raster/landcover.img"
layer_name = "Alaska"
iface.addRasterLayer(raster_file, layer_name)

Assuming you are in the directory where the file load_alaska.py is located, you can start QGIS, load the raster file landcover.img and give the layer the name 'Alaska' using the following command:

qgis --code load_alaska.py

9.6.1.17. --defaultui

On load, permanently resets the user interface (UI) to the default settings. This option will restore the panels and toolbars visibility, position, and size. Unless it's changed again, the default UI settings will be used in the following sessions.

Notice that this option doesn't have any effect on GUI customization. Items hidden by GUI customization (e.g. the status bar) will remain hidden even using the --defaultui option. See also the --nocustomization option.

9.6.1.18. --hide-browser

On load, hides the Browser panel from the user interface. The panel can be enabled by right-clicking a space in the toolbars or using the View ► Panels (Settings ► Panels in kde Linux KDE).

Unless it's enabled again, the Browser panel will remain hidden in the following sessions.

9.6.1.19. --dxf-*

These options can be used to export a QGIS project into a DXF file. Several options are available:

  • --dxf-export: the DXF filename into which to export the layers;

  • --dxf-extent: the extent of the final DXF file;

  • --dxf-symbology-mode: several values can be used here: none (no symbology), symbollayer (Symbol layer symbology), feature (feature symbology);

  • --dxf-scale-denom: the scale denominator of the symbology;

  • --dxf-encoding: the file encoding;

  • --dxf-map-theme: choose a map theme from the layer tree configuration.

9.6.1.20. --take-screenshots

Takes screenshots for the user documentation. Can be used together with --screenshots-categories to filter which categories/sections of the documentation screenshots should be created (see QgsAppScreenShots::Categories).

9.6.1.21. --profile

Loads QGIS using a specific profile from the user's profile folder. Unless changed, the selected profile will be used in the following QGIS sessions.

9.6.1.22. --profiles-path

With this option, you can choose a path to load and save the profiles (user settings). It creates profiles inside a {path}\profiles folder, which includes settings, installed plugins, processing models and scripts, and so on.

This option allows you to, for instance, carry all your plugins and settings in a flash drive, or, for example, share the settings between different computers using a file sharing service.

The equivalent environment variable is QGIS_CUSTOM_CONFIG_PATH.

9.6.1.23. --version-migration

If settings from an older version are found (e.g., the .qgis2 folder from QGIS 2.18), this option will import them into the default QGIS profile.

9.6.1.24. --openclprogramfolder

Using this option, you can specify an alternative path for your OpenCL programs. This is useful for developers while testing new versions of the programs without needing to replace the existing ones.

The equivalent environment variable is QGIS_OPENCL_PROGRAM_FOLDER.

9.6.2. Deploying QGIS within an organization

If you need to deploy QGIS within an organization with a custom configuration file, first you need to copy/paste the content of the default settings file located in your_QGIS_package_path/resources/qgis_global_settings.ini. This file already contains some default sections identified by a block starting with []. We recommend that you keep these defaults values and add your own sections at the bottom of the file. If a section is duplicated in the file, QGIS will take the last one from top to bottom.

You can change allowVersionCheck=false to disable the QGIS version check.

If you do not want to display the migration window after a fresh install, you need the following section:

[migration]
fileVersion=2
settings=true

If you want to add a custom variable in the global scope:

[variables]
organisation="Your organization"

To discover the possibilities of the settings INI file, we suggest that you set the config you would like in QGIS Desktop and then search for it in your INI file located in your profile using a text editor. A lot of settings can be set using the INI file such as WMS/WMTS, PostGIS connections, proxy settings, maptips…

Finally, you need to set the environment variable QGIS_GLOBAL_SETTINGS_FILE to the path of your customized file.

In addition, you can also deploy files such as Python macros, color palettes, layout templates, project templates… either in the QGIS system directory or in the QGIS user profile.

  • Layout templates must be deployed in the composer_templates directory.

  • Project templates must be deployed in the project_templates directory.

  • Custom Python macros must be deployed in the python directory.