Bases: qgis._core.QgsVectorLayer
Base class for application layers.
Copy all features from layer.
layer (QgsVectorLayer) – Source layer
rename (dict) – Translation of attributes names
resolve (dict) – xlink reference fields
query (func) – function with args feature and kwargs that returns a boolean deciding if each feature will be included or not
kwargs – aditional arguments for query function
Examples
>>> query = lambda feat, kwargs: feat['foo']=='bar'
Will copy only features with a value 'bar' in the field 'foo'.
>>> query = lambda feat, kwargs: layer.is_inside(feat, kwargs['zone'])
Will copy only features inside zone.
See also copy_feature().
Return bounding box in overpass format.
Use features matching expression or all features if expression is None.
Return a copy of feature renaming attributes or resolving xlink references.
feature (QgsFeature) – Source feature
rename (dict) – Translation of attributes names
resolve (dict) – xlink reference fields
Examples
With this:
>>> rename = {'spec': 'specification'}
>>> resolve = {
... 'PD_id': ('component_href', r'[\w\.]+PD[\.0-9]+'),
... 'TN_id': ('component_href', r'[\w\.]+TN[\.0-9]+'),
... 'AU_id': ('component_href', r'[\w\.]+AU[\.0-9]+')
... }
You get:
>>> original_attributes = ['localId', 'specification', 'component_href']
>>> original_values = [
... '38.012.1.12.0295603CS6109N',
... 'Parcel', (
... '(3:#ES.SDGC.PD.38.012.38570,'
... '#ES.SDGC.TN.38.012.1,'
... '#ES.SDGC.AU.38.012)'
... )
... ]
>>> final_attributes = ['localId', 'spec', 'PD_id', 'TN_id', 'AU_id']
>>> final_values = [
... '38.012.1.12.0295603CS6109N',
... 'Parcel',
... 'ES.SDGC.PD.38.012.38570',
... 'ES.SDGC.TN.38.012.1',
... 'ES.SDGC.AU.38.012'
... ]
Write layer to file.
path (str) – Path of the output file
driver_name (str) – Defaults to ESRI Shapefile.
overwrite (bool) – Defaults to True
target_crs_id (int) – Defaults to source CRS
Return progress bar with ‘description’ for ‘total’ iterations.
Replace qgis table join mechanism.
I’m not able to work with it in standalone script mode (without GUI).
source_layer (QgsVectorLayer) – Source layer.
target_field_name (str) – Join field in the target layer.
join_fieldsName (str) – Join field in the source layer.
field_names_subset (list) – List of field name strings for the target layer.
prefix (str) – An optional prefix to add to the target fields names
Reproject all features in this layer to a new CRS.
target_crs (QgsCoordinateReferenceSystem) – New CRS to apply.
Export this layer to an Osm data set.
tags_translation (function) – Function to translate fields to tags. By defaults convert all fields.
data (Osm) – OSM data set to append. By default creates a new one.
upload (str) – upload attribute of the osm dataset, default ‘never’
tags (dict) – tags to update config.changeset_tags
OSM data set