girs.feat.layers.LayersSet.rename_fields

LayersSet.rename_fields(target='', **kwargs)

Rename fields in a new LayersWriter

Create a copy of this LayersSet with the new field names given in kwargs als fieldsX, where X is the layer number. In the following example the field AREA from layer number one will be renamed to ‘AREAkm2’. The new LayerWriter created in the memory and returned to lrs1:

lrs1 = lrs0.rename_fields(fields1={'AREA': 'AREAkm2'})

For different layers:

lrs1 = lrs0.rename_fields(fields0={'N': 'NAME'}, fields1={'AREA': 'AREAkm2'})

Saving the new LayerWriter:

lrs1 = lrs0.rename_fields(fields1={'AREA': 'AREAkm2'}, target='D:/tmp/example.shp', )
Parameters:
  • target – file name or other source used in LayerWriter. If empty, creates a LayerWriter on memory.
  • kwargs
    • fields<X>: key used to address layer number <X>
    • all other kwargs are passed to LayerWriter
Returns:

LayersWriter with the new field names