7.5. Data transfer
NextGIS Connect module allows you to share geodata between QGIS and Web GIS in both directions. See below for the specifics.
7.5.1. Resource types
The following types of resources are available for data exchange and operation:
- Vector layer (NGW Vector Layer), which can be:
- Point vector layer (NGW Vector Layer);
- Multipoint vector layer (NGW Vector Layer);
- Line vector layer (NGW Vector Layer);
- Multiline vector layer (NGW Vector Layer);
- Polygon vector layer (NGW Vector Layer);
- Multipolygon vector layer (NGW Vector Layer);
- Vector layer style. QGIS style gets “(qgis)” prefix, MapServer style - “(ms)”
- WFS Service (NGW WFS Service)
- WMS Service (NGW WMS Service)
- TMS Layer
- PostGIS Layer
- Raster layer (NGW Raster Layer)
- Basemap
- Web Map (NGW Web Map)
- Resource group
7.5.2. From QGIS to Web GIS
NextGIS Connect module allows you to import:
Vector data
Raster data
Basemaps - only for ‘Mini’ or ‘Premium’ plans
Entire QGIS project
Algorithm for importing each data type is described here.
![../../_images/add_to_ngw_en.png](../../_images/add_to_ngw_en.png)
Pic. 7.12. Data import menu
Vector layer – vector layer with its style will be imported into Web GIS. You can later add this style to a Web Map.
Raster layer – raster layer with a default style will be created in Web GIS. Style can be added directly to Web Map.
Upload all - All layers for which the import option is available will be added to Web GIS, as well as all groups, retaining the hierarchy from QGIS Layers Panel. Also a Web Map will be created and all imported layers will be added to it retaining hierarchy and visibility of QGIS Layers Panel. While importing a project you need to specify the name of the new resource group which will be created in Web GIS. This group will hold all resources imported along with the project. When the process is complete, the Web Map will be opened automatically if corresponding option is selected in plugin settings.
Update layer style - Web GIS will update the style of the layer to match the style of the selected layer in QGIS.
Add new style to layer - Web GIS will add to the layer a new style, similar to the selected layer in QGIS.
If a layer has multiple styles, they will all be uploaded. Their names will be kept. If the style name is “default”, the layer’s name will be used instead.
Imported resources will be added to the group selected in NextGIS Connect panel.
If other type of resource but a group is selected, import will be performed to the closest parent group to selected resource.
If no resource is selected, import will be performed to the Main resource group (the root directory).
Warning
Photos made via NextGIS Collector/Mobile apps and uploaded to Web GIS as attachments to layers wouldn’t be available in desktop NextGIS QGIS after downloading these layers through NextGIS Connect plugin.
7.5.3. From Web GIS to QGIS
![Add to QGIS](../../_images/add_to_qgis_en.png)
Pic. 7.14. Button for data transfer to QGIS
Option is available if one of the following resources is selected in NextGIS Web resource tree:
Vector layer (NGW Vector Layer)
- GeoJSON vector layer will be created in QGIS;
WFS service (NGW WFS Service)
- WFS layer will be created in QGIS;
WMS Layer - the selected WMS layer will be added to QGIS;
WMS Service - a WMS layer will be created in QGIS, the data source for which the selected WMS Service will be;
WMS Connection - you can select the WMS layer from the list to add to QGIS;
TMS Layer
;
PostGIS Layeer
;
QGIS style of a vector layer
- GeoJSON vector layer with the style identical to selected one will be created in QGIS;
Raster layer (NGW Raster layer)
- a GeoTIFF raster layer will be created in QGIS;
Basemap|basemap_symbol|;
Web Map
- a QGIS project will be created containing layers, styles and basemaps;
Demo Project
- a QGIS project will be created, containing layers, styles and basemaps.
For layers with multiple styles:
If you select a layer with multiple styles in the Connect window, all the styles will be added, but you need to chose current style in a dialog window.
If you select a style in the Connect window, all the styles of the layer will be added, with the selected style chosen as current style.
If you select a resource group containing layers with multiple styles, all the styles will be added. The style used as current will be the one with the same name as the layer or the first in alphabetical order. No dialog will be displayed.
If you add WFS/OGCF, the style with the same name as the layer or the first in alphabetical order will be chosen.
The algorithm for Exporting data to QGIS is described here.
7.5.5. Edit layers
Vector layers added from Web GIS can be edited immediately after import to QGIS. Only one user at a time can edit the layer directly. This allows the layer to be edited even with no Internet connection. The changes will be saved to the device and transfered to Web GIS when the connection is restored.
Layer styles are preserved during both import and export of the edited layer.
Note
This functionality is only available for vector data formats used in QGIS.
Enter the edit mode from the layer’s context menu or from the toolbar.
Make the changes.
Exit edit mode. Confirm changes in the pop-up window.
The layer will be automatically synchronized.
To check when the layer was last synchronized, hover over the sync symbol.
![Sync information](../../_images/ngc_check_sync_en1.png)
Pic. 7.17. Synchronization information
Press the symbol to open the layer status window.
![Layer status dialog](../../_images/ngc_layer_status_en1.png)
Pic. 7.18. Layer status dialog
It has the date and time of the latest synchronization and the status: synchronized or not synchronized.
You can start the process manually by pressing the Synchronization button.
Important
While the layer is in edit mode, synchronization is not available.
If changes have been made to the layer in Web GIS since the last synchronization, further synchronization will not be possible and a message will appear. To continue working with the layer you need to reload it by resetting it to the current state it is in NGW. In the synchronization dialog in the dropdown menu select Reset layer. Keep in mind that if you reset the layer, all local changes that had not been synchronized will be lost.
If the edits made in the cloud were incorrect and you need to replace them with local ones, you can use the Data overwrite function.
7.5.6. Update data or styles
Warning
When the layer is updated, all data of the target layer including attachments (photos, documents) will be cleared. If you need to save them, use WFS. If the style is updated, the attachments will not be affected.
NextGIS Connect allows you to edit data in QGIS and then return it to the Web. Thus, the data is updated in the Web GIS. This operation is available if a vector layer is selected in the resource tree.
Select two vector layers: in the resource tree of NextGIS Connect and in QGIS Layers Panel. This operation will remove all features from the layer in Web GIS and upload all features from the local layer into that layer. A similar algorithm works for styles as well.
7.5.7. Manage data with WMS/WFS and OGC services
NextGIS Connect plugin allows to publish vector data using standard protocols WFS, WMS and OGC. To do this, in the context menu of the required layer select the appropriate operation. More info here.
7.5.8. Lookup tables
In Web GIS you can create Lookup tables and link them to vector layers.
When the layer is exported from Web GIS to QGIS the values of the lookup table will be added to the layer using value map widget. After that they will be available in the desktop app in the corresponding field of the table when you enter edit mode.
![../../_images/ngc_lookup_en.png](../../_images/ngc_lookup_en.png)
Pic. 7.19. Lookup table values available during editing in QGIS
In QGIS you can use Value relation widget to add another vector layer as a lookup table or upload a CSV file. When the layer is transfered to Web GIS, a Lookup table resource will be created for it.
7.5.9. Other operations
This block of operations is located in the top menu of the NextGIS Connect.
7.5.9.1. Create resource group
New group will be created:
In the resource group selected via NextGIS Connect panel.
If other type of resources but a group is selected - in the closest parent group .
If no resource is selected - in the main resource group.
![Create new group](../../_images/create_group_en.png)
Pic. 7.20. Creating resource group