GeoProcessor / Command / RemoveGeoLayerAttributes
Overview
The RemoveGeoLayerAttributes
command removes one or more attributes from a GeoLayer.
Command Editor
The following dialog is used to edit the command and illustrates the command syntax.
RemoveGeoLayerAttributes
Command Editor (see full-size image)
Command Syntax
The command syntax is as follows:
RemoveGeoLayerAttributes(Parameter="Value",...)
Command Parameters
Parameter | Description | Default |
---|---|---|
GeoLayerID required |
The ID of the GeoLayer with the attribute to be removed. | None - must be specified. |
AttributeNames required |
The names of the attributes to be removed. Separated by commas. Case-specific. | None - must be specified. |
Examples
See the automated tests.
The following GeoLayer data is used in the example.
The example assumes that the ExampleGeoLayer
GeoLayer has already been read into the
GeoProcessor with the ReadGeoLayerFromGeoJSON
command.
Example GeoLayer Data
GeoLayerID |
---|
ExampleGeoLayer |
ExampleGeoLayer's Attribute Table
id | school | mascot | students | faculty |
---|---|---|---|---|
1 | Hill | Bulldogs | 546 | 42 |
2 | Bright | Gators | 304 | 24 |
3 | Gunn | Colts | 567 | 43 |
Example 1: Remove Attributes
RemoveGeoLayerAttributes(GeoLayerID="ExampleGeoLayer", AttributeNames="mascot, students")
After running the command, the ExampleGeoLayer has the following attribute table.
id | school | faculty |
---|---|---|
1 | Hill | 42 |
2 | Bright | 24 |
3 | Gunn | 43 |
Troubleshooting
See Also
- GeoLayer attributes are removed using the
QGIS QGSVectorDataProvider Class
. See documentation for examples on utilizing theQgsVectorDataProvider
class in the PyQGIS environment. AddGeoLayerAttribute
command