Skip to content

FieldNamePostprocessor

Bases: GeodataPostprocessor

Geodata postprocessor that renames the fields

Examples:

Assume the geodataframe has the field 'class'.

You can rename the field 'class' to 'type'.

>>> field_name_postprocessor = FieldNamePostprocessor(
...     mapping={
...         'class': 'type',
...     },
... )
...
>>> gdf = field_name_postprocessor(gdf)
PARAMETER DESCRIPTION
mapping

mapping of the field names (old field name: new field name)

TYPE: dict

from_config classmethod

Creates a field name postprocessor from the configuration.

PARAMETER DESCRIPTION
config

configuration

TYPE: FieldNamePostprocessorConfig

RETURNS DESCRIPTION
FieldNamePostprocessor

field name postprocessor

__call__

Postprocesses the geodata by renaming the fields.

PARAMETER DESCRIPTION
gdf

geodataframe

TYPE: gpd.GeoDataFrame

RETURNS DESCRIPTION
gpd.GeoDataFrame

postprocessed geodataframe


FieldNamePostprocessorConfig

Bases: pydantic.BaseModel

Configuration for the from_config class method of FieldNamePostprocessor

ATTRIBUTE DESCRIPTION
mapping

mapping of the field names (old field name: new field name)

TYPE: dict