Skip to content

RenameFieldsProcessor

Vector processor that renames fields of a layer

Implements the VectorProcessor protocol.

PARAMETER DESCRIPTION
layer_name

Layer name

TYPE: str

mapping

Mapping of the field names

TYPE: dict[object, object]

new_layer_name

New layer name

TYPE: str | None DEFAULT: None

from_config classmethod

Creates a rename fields processor from the configuration.

PARAMETER DESCRIPTION
config

Configuration

TYPE: RenameFieldsProcessorConfig

RETURNS DESCRIPTION
RenameFieldsProcessor

Rename Fields processor

__call__

Renames the fields of the layer.

PARAMETER DESCRIPTION
vector

Vector

TYPE: Vector

RETURNS DESCRIPTION
vector

Vector

TYPE: Vector


RenameFieldsProcessorConfig

Bases: pydantic.BaseModel

Configuration for the from_config class method of RenameFieldsProcessor

Create the configuration from a config file
  • Use null instead of None
Example

You can create the configuration from a config file.

config.yaml
package: 'aviary'
name: 'RenameFieldsProcessor'
config:
  layer_name: 'my_layer'
  mapping:
    'old_field': 'new_field'
  new_layer_name: 'my_new_layer'
ATTRIBUTE DESCRIPTION
layer_name

Layer name

TYPE: str

mapping

Mapping of the field names

TYPE: dict[object, object]

new_layer_name

New layer name - defaults to None

TYPE: str | None