Mapper
Classes to map Niva ID to IACS layer.
Mapper()
¶
Bases: abc.ABC
Mapper base class to join NIVA ID.
Attributes:
Name | Type | Description |
---|---|---|
map_dict |
typing.Dict[typing.Any, int]
|
Dict that map any nomenclature to Niva ID. |
mapping_json |
str
|
Path a json file to load map_dcit from. Class attribute. |
Source code in niva/core/mapper/niva_mapper.py
16 17 18 19 20 21 22 |
|
map(layer, field)
¶
Map NIVA ID to layer based on field.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
layer
|
qgis.core.QgsVectorLayer
|
Layer to add NIVA ID. |
required |
field
|
str
|
Mapping field. |
required |
Returns:
Type | Description |
---|---|
qgis.core.QgsVectorLayer
|
Layer with NIVA ID field. |
Source code in niva/core/mapper/niva_mapper.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
|
LucasMapper()
¶
Bases: niva.core.mapper.niva_mapper.Mapper
Mapper with LUCAS nomenclature.
>>> iacs = QgsVectorLayer('/path/to/iacs.shp')
>>> lucas_mapper = LucasMapper()
>>> mapped_iacs = lucas_mapper.map(iacs, field='LUCAS')
Source code in niva/core/mapper/niva_mapper.py
16 17 18 19 20 21 22 |
|
RPGMapper()
¶
Bases: niva.core.mapper.niva_mapper.Mapper
Mapper with RPG code culture nomenclature.
>>> iacs = QgsVectorLayer('/path/to/iacs.shp')
>>> rpg_mapper = RPGMapper()
>>> mapped_iacs = rpg_mapper.map(iacs, field='CODE_CULTURE')
Source code in niva/core/mapper/niva_mapper.py
16 17 18 19 20 21 22 |
|
CustomCsvMapper(csv)
¶
Bases: niva.core.mapper.niva_mapper.Mapper
Mapper with custom csv nomenclature.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
csv
|
``str``
|
Path to custom nomenclature as .csv file. |
required |
>>> iacs = QgsVectorLayer('/path/to/iacs.shp')
>>> csv_path = '/path/to/custom_nomenclature.csv'
>>> csv_mapper = CustomCsvMapper(csv='csv_path')
>>> mapped_iacs = csv_mapper.map(iacs, field='FIELD_TO_MAP')
Source code in niva/core/mapper/niva_mapper.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|