跳转至

QFieldSync

The QFieldSync plugin for QGIS helps preparing and packaging QGIS projects for QField.

QField同步通过自动执行以下操作来支持工程准备工作:

  • Required steps for project setup (e.g. portable_project)
  • 从单个栅格图层或地图主题中定义的样式 创建底图。
  • 配置离线编辑功能和同步 回更改。

工作流程

请快速了解该过程,主要包含以下典型步骤:

  1. 创建QField包。这是单独文件夹中的 folder.
  2. 将QField包复制到目标设备。
  3. 外出并收集数据。
  4. 将修改的数据拷回计算机。
  5. 将修改的数据与数据库或文件同步。

安装

在QGIS中打开插件库并搜索 qfield sync ,在列表中选择插件并单击 安装

QGIS插件库中的QField同步插件
QGIS插件库中的QField同步插件

配置

The project configuration is saved in the master .qgs project file. This way it is possible to pre-configure a project once and use it repeatedly.

配置工程
配置工程

图层配置

配置工程图层
配置工程图层

In the project configuration dialog, an action can be defined for each layer individually. Depending on the layer type, different types of actions are available.

Copy

The layer will be copied to the package folder. This is only available for file-based layers.

No action

图层源将保持不变。这仅适用于非基于文件的图层,如 WMS、WFS、Postgis 等。

Offline editing

A working copy of the layer is copied into the package folder. Every change which is done in the packaged project during work is recorded in a changelog. When synchronizing the changes back later on, this log will be replaced and all changes also be applied to the main data base. There is no conflict handling in place.

Remove

The layer will be removed from the working copy. This is useful if a layer is used in the basemap and will not be available in the packaged project.

Properties

There are some additional options to fine tune your QField project in the properties:

  1. Permissions: Disable options for feature addition, feature deletion, attribute editing, or geometry editing.

  2. 设置附件默认命名,请查阅 可配置图片路径

  3. Set up the maximum number of items shown in the relation editor widget.

QField同步图层属性
QField同步图层属性

Configuring maximum items visibility for QField

To adjust the maximum number of visible items in a relationship within QField, follow these steps:

  1. Access Layer Properties Dialog:
  2. Open the layer properties dialog in QGIS where the relation editor is displayed.

  3. Navigate to QField Tab:

  4. Locate the QField tab, typically located at the bottom of the layer properties dialog.

  5. Modify Relationship Configuration:

  6. In the "Relationship configuration" section, locate the section corresponding to the relationship you want to modify.

  7. Adjust Visibility Limit:

  8. Within the row for the desired relationship, find the "Maximum number of items visible" column.
  9. Delete the existing numerical value to set the visibility to "unlimited", the field will transform from a number (default 4) to "unlimited".
  10. Click "Apply" to save the changes to the layer properties.

Maximum items visible for relation
Maximum items visible for relation

QField Visible items
QField Visible items

配置底图

底图是栅格图层,将作为最底图层添加到打包的工程文件中。

如果启用了底图选项,无论何时打包工程,都将渲染底图。感兴趣的区域 (将渲染的范围) 在打包时进行选择。

底图有两种可能的来源:

图层

A raster layer is useful for taking an offline copy of an online layer like a WMS or to take a working copy of an unsupported format like an ECW or MrSID layer.

地图主题

A map theme is useful for creating a base map based on a combination of several layers with styling. These layers can then be removed from the working package and do not need to be rendered on the device. This can save some disk space and battery on the device.

The tile size defines the spatial resolution. It determines the number of map units per pixel. If the map canvas CRS has meters as units and tile size is set to 1, each raster pixel will have a spatial extent of 1x1 m, if it is set to 1000, each raster pixel will have a spatial extent of 1 square kilometer.

You can package a raster layer into an MBTiles file with multiple zoom levels for offline use.

  • Tiles min zoom level: Defines the minimum zoom level for the raster tiles. A lower value increases the spatial coverage but the spatial resolution is limited. (Default: 14)
  • Tiles max zoom level: Defines the maximum zoom level for the raster tiles. A higher value increases detail but may require more storage space, as well as increase the duration of the offline export. (Default: 14)

Base Map Configuration QFieldSync
Base Map Configuration QFieldSync

Note

Base map generation is disabled on QFieldCloud. You can still manually add your basemaps by running "Generate XYZ tiles (MBTiles)" or "Convert map to raster" algorithms in the processing framework.

离线编辑配置

If "Only synchronize features in area of interest" is selected, only features that are within the established extent area or the current map canvas (if not set) at packaging time will be copied to the offline editing working copy.

Note

This is available only for the "Cable Export" option.

为QField打包

To package your project, click on Plugins > QFieldSync > Package for QField. Once the project is configured, proceed to package it into a folder. This folder will contain both the QGIS project file (.qgs) and the associated data.

为QField打包工程
为QField打包工程

即使默认QFieldSync不会在工具栏面板显示打包选项,仍可以通过 "插件 > QFieldSync > 首选项" 进行访问。

QFieldSync首选项按钮
QFieldSync首选项按钮

只需激活标有 "在工具栏显示打包动作" 的复选框

QFieldSync首选项
QFieldSync首选项

Copy the folder on your device. Open QField, open the project and start collecting data.

Also make sure to save the QGIS project using the regular Save As of QGIS as you'll have to re-open it later when you want to synchronize the changes.

在打包工程时,您可以通过检查 高级 -> 要复制的目录 中的目录来选择要复制的子目录。

Select subdirectories
Select subdirectories

如何在没有QFieldCloud的情况下从iOS设备同步或同步到iOS设备

使用iTunes的文件共享功能导入到QField根文件夹。

  1. 打开iTunes应用程序,单击iTunes窗口左上方的iPhone按钮。
  2. 单击左侧边栏中的 文件共享 选项。
  3. 选择应用程序QField并单击 添加文件 ,将打开文件浏览器。
  4. 选择文件。

从QField同步

当你需要同步采集的数据时,在QGIS中重新打开该项目(“定期另存为”的项目)。

Copy the project folder from your device to your computer, and use the Synchronize from QField menu to synchronize your changes from the protable project to the main project.

Synchronize from QField
Synchronize from QField

Make sure that you synchronize your data back only once. That means, if you go out again to collect more data, you should create a new QField package before to avoid sync problems later on (like e.g. duplicates).