
Set or Clear a Layer's Provider Subset in a QGIS Project
Source:R/rfp_qgs_subset.R
rfp_qgs_subset_set.RdWrites the SQL WHERE clause the OGR provider applies, onto a layer already
in a project - the repair half of rfp_qgs_vector_add()'s subset =, and
the only way to filter a layer without a QGIS Desktop round trip. Until this
existed every filtered layer in the fleet was hand-written XML, reproducible
by nothing (#318).
Details
Both datasource surfaces are written. QGIS keeps the string on the
<maplayer>'s <datasource> and on the <layer-tree-layer>'s @source,
and each keeps its own path - the two routinely differ there, in 48 of 54
layers in bcfishpass_mobile, so this replaces only the subset= option on
each rather than copying one string over the other.
The layer is not otherwise touched. Its id, name, style, theme membership and tree position are the surfaces a rebuild would move; nothing here rebuilds a node.
Quote string literals with single quotes. A double-quoted token is an
SQL identifier, and one naming no column of the layer is refused - see
rfp_qgs_vector_add().
See also
Other qgs:
rfp_qgs_form_add(),
rfp_qgs_layer_rm(),
rfp_qgs_preview_set(),
rfp_qgs_raster_add(),
rfp_qgs_service_add(),
rfp_qgs_service_rm(),
rfp_qgs_services(),
rfp_qgs_style_export(),
rfp_qgs_style_set(),
rfp_qgs_subset_get(),
rfp_qgs_theme_add(),
rfp_qgs_theme_lookup(),
rfp_qgs_theme_names(),
rfp_qgs_theme_rm(),
rfp_qgs_theme_set(),
rfp_qgs_theme_unbury(),
rfp_qgs_themes(),
rfp_qgs_vector_add(),
rfp_qwc_config_create(),
rfp_raster_style_path(),
rfp_raster_styles()