Brazilian Institute of Environment and Renewable Natural Resources
Use for Python Action in QGIS
Luiz Motta
- The layer with action need stay in database (Postgis or Spatialite)
- Create a layer with query.
- Works with 'addlayersql.py' and 'Header's script'
- Main script for run SQL Query (Postgis and Spatialite) and create layer
- Use for join with 'Header's script'
- DON'T CHANGE this script
- Join 'addlayersql.py' with 'Header's script' and copy to Clipboard (paste this script in Layer's Action)
- Example: ./create_action header_add_landsat.py
- After run this script, paste code in Action property of layer
- Test Class AddLayerSQL in console QGIS
- Model for define Header
- Variables:
- feat_filter: Field from layer where use in SQL (use double quotes for String type)
- nameModulus: Name this action for display in Message Bar
- layerSQL: Name of layer that will be created by Action (use value of feat_filter)
- style: Name of style, can be a None, QML file or the name of style in 'layer_styles' table and the 'styleQML' field
- geomName: Name of geometry field in SELECT
- sql: SQL with query, see type of filter field
- Example for Postgis
- Example for Spatialite
- 2016-02-24 Add style in DB
- 2016-02-22 Initial scripts for SQL Query