safe.impact_functions.bases.utilities module

safe.impact_functions.bases.utilities.check_attribute_exist(layer, attribute)[source]

Check an attribute is exists in the layer.

  • layer (QgsVectorLayer) – A layer to check
  • attribute (str, unicode) – the attribute to check in the layer

True if the attribute exists

Return type:


safe.impact_functions.bases.utilities.check_layer_constraint(metadata, hazard_layer_mode, hazard_layer_geometries, exposure_layer_mode, exposure_layer_geometries)[source]

Check the layer constraint in metadata is relevant with the base class used.

  • metadata (ImpactFunctionMetadata) – the metadata of the class
  • hazard_layer_mode (dict) – the layer_mode of hazard layer
  • hazard_layer_geometries (list) – the layer_geometry allowed for hazard layer
  • exposure_layer_mode (dict) – the layer_mode of exposure_layer
  • exposure_layer_geometries – the layer_geometry allowed for

exposure_layer :type exposure_layer_geometries: list

Returns:True if valid
Return type:bool