QGIS Integration Execution
Introduction
QGIS integration with Assetic Cloud Platform is supported by the assetic-qgis integration package. Please refer to the article QGIS Integration Introduction prior for more information about the assetic-qgis integration package and installation.
The assetic-qgis integration package requires 2 configuration files to be prepared before using the package. The preparation of these files is described in detail in the article QGIS Integration Configuration.
The QGIS 'Processing Toolbox' is used to execute the Assetic QGIS Integration. One or more python scripts can be added to the toolbox to execute the integration. The scripts initiate the assetic-qgis integration package and then execute the integration.
Toolbox Scripts
Assets
There are 2 toolbox scripts available for download to initiate 'Asset Creation' and 'Asset Update':
Note: You may need to right click and 'Save As' to download.
Functional Location
There are 2 prebuilt scripts available for download to initiate 'Functional Location Creation' and 'Functional Location Update':
Note: You may need to right click and 'Save As' to download.
Configuration Validation
The following toolbox script will run a set of tests to validate the configuration defined in the XML configuration file. Note that the validation is script is unable to validate every aspect of the configuration due to the dynamic nature of the integration (e.g. The actual GIS attribute values are unknown until the integration processes each feature).
Note: You may need to right click and 'Save As' to download.
Script Options
Buffered Edit
In some instances QGIS fails to update the feature table with the Assetic Asset ID/Unique GUID.
This has been observed for some installations of QGIS when editing an SQL Server table. The reasons for this are unclear, but to cater for it there is an option within the integration to apply the edits using a alternate method (via the data provider). If this issue is encountered, the 'Create Asset Script' (Assetic_Create_Asset.py) and 'Create Functional Location Script' (Assetic_Create_Functional_Location.py) can be modified to set the parameter 'use_buffered_edits' to 'False'.
Edit Assetic_Create_Asset.py to set 'use_buffered_edits' to 'False
results = self.tools.create_assets(source, use_buffered_edit=False)
Assetic_Create_Functional_Location.py to set 'use_buffered_edits' to 'False
results = self.tools.create_funclocs_from_layer(source, use_buffered_edit=False)
Saving Edits prior to integration
In some instances QGIS fails to update the feature table with the Assetic Asset ID/Unique GUID because the unique ID of the feature is not set.
This has been observed for some installations of QGIS when editing an SQL Server table. The reasons for the unique ID not being set are not clear, but in most instances saving edits prior to running the integration resolve this issue.
To test if the unique ID of the feature has been set the 'Create Asset Script' (Assetic_Create_Asset.py) and 'Create Functional Location Script' (Assetic_Create_Functional_Location.py) can be modified to set the parameter 'test_id' to 'True'.
For both files change the following line in the script to set test_id = True :
# test if valid unique integer ID set. set 'test_id = True' to use test
test_id = True
If the unique feature ID hasn't been set it will be a negative number. The test will detect this and cancel the integration before it has created any new records in Assetic. Save the edits in QGIS and try again.
Script Installation
The integration script is made available in the Processing Toolbox via the following steps:
- Open QGIS and the QGIS Processing Toolbox.
- In the set of icons at the top of the toolbox is a ‘Scripts’ icon (highlighted in screenshot).
- Choose the “Add Script to Toolbox…” option.
- Choose the supplied integration script (python file) and select 'Open'.
- If “Scripts” disappears from the Processing Toolbox then it means there was an error loading the script. The error will need to be resolved before the 'Scripts' menu can be accessed.
- The script to execute the integration will appear in a new 'Assetic' folder within the 'Scripts' folder
Script Execution
The integration script processes only those features that are currently 'selected'. This allows the user to define which features to process.
Steps
- Select the assets to process.
- Click on the script e.g. 'Create Asset'.
- Choose the layer to process.
- Check the results to ensure all records were processed.