sec_interp.exporters package

class sec_interp.exporters.AxesVectorExporter(settings: dict[str, Any])

Bases: BaseExporter

Exports the profile axes to a vector file (SHP, GPKG, DXF).

export(output_path: Path, data: dict[str, Any], layer_name: str | None = None) bool

Export the profile axes to a vector file.

Parameters:
  • output_path – Path to the output file.

  • data – Dictionary containing ‘profile_data’ and ‘crs’.

  • layer_name – Optional conceptual layer name.

get_supported_extensions() list[str]

Get supported file extensions.

Returns:

List of supported extensions.

class sec_interp.exporters.BaseExporter(settings: dict[str, Any])

Bases: ABC

Abstract base class for all exporters.

This class defines the interface that all concrete exporters must implement. It follows the Template Method pattern, providing common initialization and validation logic while delegating format-specific export to subclasses.

__init__(settings: dict[str, Any]) None

Initialize the exporter with settings.

Parameters:

settings – Dictionary containing export settings such as: - width: Output width in pixels - height: Output height in pixels - dpi: Dots per inch for resolution - background_color: Background color (QColor) - legend_renderer: Optional renderer for legend overlay

abstractmethod export(output_path: Path, data: Any, layer_name: str | None = None) bool

Export data to file.

This method must be implemented by all concrete exporters.

Parameters:
  • output_path – Destination file path

  • data – Data to export (format depends on exporter type)

  • layer_name – Optional conceptual name for the layer (e.g. inside a GeoPackage)

Returns:

True if export successful, False otherwise

Return type:

bool

get_setting(key: str, default: Any = None) Any

Get a setting value with optional default.

Parameters:
  • key – Setting key

  • default – Default value if key not found

Returns:

Setting value or default

abstractmethod get_supported_extensions() list[str]

Get list of supported file extensions.

Returns:

List of supported extensions (e.g., [‘.png’, ‘.jpg’])

validate_export_path(output_path: Path, base_dir: Path | None = None) tuple[bool, str]

Validate export path for security.

Uses secure path validation to prevent path traversal attacks.

Parameters:
  • output_path – Path to validate

  • base_dir – Optional base directory to restrict exports to

Returns:

(is_valid, error_message)

Return type:

tuple

validate_path(path: Path) bool

Validate that the output path has a supported extension.

Parameters:

path – Path to validate

Returns:

True if path has a supported extension, False otherwise

class sec_interp.exporters.CSVExporter(settings: dict[str, Any])

Bases: BaseExporter

Exporter for CSV tabular format.

export(output_path: Path, data: dict[str, Any], layer_name: str | None = None) bool

Export tabular data to CSV.

Parameters:
  • output_path – Output file path.

  • data – A dictionary containing ‘headers’ (list of strings) and ‘rows’ (list of tuples or lists).

  • layer_name – Optional conceptual name for the layer (ignored for CSV).

Returns:

True if export successful, False otherwise

get_supported_extensions() list[str]

Get supported CSV extension.

class sec_interp.exporters.DXFExporter(settings: dict[str, Any])

Bases: BaseExporter

Exporter for DXF format.

export(output_path: Path, features_data: list[dict[str, Any]], layer_name: str | None = None) bool

Export features to DXF.

Parameters:
  • output_path – Output file path.

  • features_data – List of dicts with ‘geometry’ and ‘attributes’ keys.

  • layer_name – Optional conceptual layer name.

Returns:

True if export successful, False otherwise.

get_supported_extensions() list[str]

Get supported vector format extensions.

class sec_interp.exporters.DrillholeInterval3DExporter(settings: dict[str, Any])

Bases: BaseExporter

Exports 3D drillhole intervals to a Shapefile.

export(output_path: Any, data: dict[str, Any], layer_name: str | None = None) bool

Export 3D drillhole intervals to a Shapefile.

Parameters:
  • output_path – Path to the output Shapefile.

  • data – Dictionary containing ‘drillhole_data’ and ‘crs’. Can include ‘use_projected’ (bool).

  • layer_name – Optional conceptual layer name.

Returns:

True if export successful, False otherwise.

Return type:

bool

get_supported_extensions() list[str]

Get supported extensions.

class sec_interp.exporters.DrillholeIntervalVectorExporter(settings: dict[str, Any])

Bases: BaseExporter

Exports drillhole intervals to a vector file (SHP, GPKG, DXF).

export(output_path: Any, data: dict[str, Any], layer_name: str | None = None) bool

Export drillhole intervals to a vector file.

Parameters:
  • output_path – Path to the output file.

  • data – Dictionary containing ‘drillhole_data’ and ‘crs’.

  • layer_name – Optional conceptual layer name.

Returns:

True if export successful, False otherwise.

Return type:

bool

get_supported_extensions() list[str]

Get supported file extensions.

Returns:

List of supported extensions.

class sec_interp.exporters.DrillholeTrace3DExporter(settings: dict[str, Any])

Bases: BaseExporter

Exports 3D drillhole traces to a Shapefile.

export(output_path: Any, data: dict[str, Any], layer_name: str | None = None) bool

Export 3D drillhole traces to a Shapefile.

Parameters:
  • output_path – Path to the output Shapefile.

  • data – Dictionary containing ‘drillhole_data’ and ‘crs’. Can include ‘use_projected’ (bool).

  • layer_name – Optional conceptual name for the layer.

Returns:

True if export successful, False otherwise.

Return type:

bool

get_supported_extensions() list[str]

Get supported extensions.

class sec_interp.exporters.DrillholeTraceVectorExporter(settings: dict[str, Any])

Bases: BaseExporter

Exports drillhole traces to a vector file (SHP, GPKG, DXF).

export(output_path: Any, data: dict[str, Any], layer_name: str | None = None) bool

Export drillhole traces to a vector file.

Parameters:
  • output_path – Path to the output file.

  • data – Dictionary containing ‘drillhole_data’ and ‘crs’.

  • layer_name – Optional conceptual layer name.

Returns:

True if export successful, False otherwise.

Return type:

bool

get_supported_extensions() list[str]

Get supported file extensions.

Returns:

List of supported extensions.

class sec_interp.exporters.GeologyVectorExporter(settings: dict[str, Any])

Bases: BaseExporter

Exports the geological profile to a vector file (SHP, GPKG, DXF).

export(output_path: Path, data: dict[str, Any], layer_name: str | None = None) bool

Export the geological profile to a vector file.

Parameters:
  • output_path – Path to the output file.

  • data – Dictionary containing ‘geology_data’ and ‘crs’.

  • layer_name – Optional conceptual layer name.

get_supported_extensions() list[str]

Get supported file extensions.

Returns:

List of supported extensions.

class sec_interp.exporters.ImageExporter(settings: dict[str, Any])

Bases: BaseExporter

Exporter for raster image formats (PNG, JPG, JPEG).

export(output_path: Path, map_settings: qgis.core.QgsMapSettings) bool

Export map to raster image.

Parameters:
  • output_path – Output file path

  • map_settings – QgsMapSettings instance configured for rendering

Returns:

True if export successful, False otherwise

get_supported_extensions() list[str]

Get supported image extensions.

class sec_interp.exporters.Interpretation2DExporter(settings: dict[str, Any])

Bases: BaseExporter

Exports interpretations in 2D profile coordinates.

__init__(settings: dict[str, Any]) None

Initialize with settings.

Parameters:

settings – Dictionary of configuration settings.

export(output_path: Path, data: dict[str, Any], layer_name: str | None = None) bool

Export interpretations to Shapefile.

Parameters:
  • output_path – Path to the output Shapefile (.shp)

  • data – Dictionary containing: - interpretations: List of InterpretationPolygon objects

  • layer_name – Optional conceptual name for the layer (e.g. inside a GeoPackage)

Returns:

True if export successful, False otherwise

Return type:

bool

get_supported_extensions() list[str]

Get supported file extensions.

class sec_interp.exporters.Interpretation3DExporter(settings: dict[str, Any])

Bases: BaseExporter

Exporter for 3D Interpretation polygons (Shapefile 2.5D).

export(output_path: str, data: dict[str, Any], layer_name: str | None = None) bool

Export interpretation data to a 3D Shapefile.

get_supported_extensions() list[str]

Get supported extensions.

class sec_interp.exporters.PDFExporter(settings: dict[str, Any])

Bases: BaseExporter

Exporter for PDF format.

export(output_path: Path, map_settings: qgis.core.QgsMapSettings) bool

Export map to PDF.

Parameters:
  • output_path – Output file path

  • map_settings – QgsMapSettings instance configured for rendering

Returns:

True if export successful, False otherwise

get_supported_extensions() list[str]

Get supported PDF extension.

class sec_interp.exporters.ProfileLineVectorExporter(settings: dict[str, Any])

Bases: BaseExporter

Exports the topographic profile line to a vector file (SHP, GPKG, DXF).

export(output_path: Path, data: dict[str, Any], layer_name: str | None = None) bool

Export the topographic profile line to a vector file.

Parameters:
  • output_path – Path to the output file.

  • data – Dictionary containing ‘profile_data’ and ‘crs’.

  • layer_name – Optional conceptual layer name.

get_supported_extensions() list[str]

Get supported file extensions.

Returns:

List of supported extensions.

class sec_interp.exporters.SVGExporter(settings: dict[str, Any])

Bases: BaseExporter

Exporter for SVG vector format.

export(output_path: Path, map_settings) bool

Export map to SVG.

Parameters:
  • output_path – Output file path

  • map_settings – QgsMapSettings instance configured for rendering

Returns:

True if export successful, False otherwise

get_supported_extensions() list[str]

Get supported SVG extension.

class sec_interp.exporters.StructureVectorExporter(settings: dict[str, Any])

Bases: BaseExporter

Exports the structural profile to a vector file (SHP, GPKG, DXF).

export(output_path: Path, data: dict[str, Any], layer_name: str | None = None) bool

Export the structural profile to a vector file.

Parameters:
  • output_path – Path to the output file.

  • data – Dictionary containing ‘structural_data’, ‘crs’, ‘dip_scale_factor’, and ‘raster_res’.

  • layer_name – Optional conceptual layer name.

get_supported_extensions() list[str]

Get supported file extensions.

Returns:

List of supported extensions.

class sec_interp.exporters.VectorExporter(settings: dict[str, Any])

Bases: BaseExporter

Generic exporter for vector formats (SHP, GPKG, DXF).

export(output_path: Path, features_data: list[dict[str, Any]], layer_name: str | None = None) bool

Export features to a vector file.

Parameters:
  • output_path – Output file path.

  • features_data – List of dicts with ‘geometry’ and ‘attributes’ keys.

  • layer_name – Optional layer name for multi-layer containers (GeoPackage).

Returns:

True if export successful, False otherwise.

get_supported_extensions() list[str]

Get supported vector format extensions.

sec_interp.exporters.get_exporter(extension: str, settings: dict) BaseExporter

Get the appropriate exporter instance for the file extension.

Parameters:
  • extension – File extension (e.g., ‘.png’, ‘.svg’, ‘.dxf’)

  • settings – Export settings dictionary

Returns:

Appropriate exporter instance

Raises:

ValueError – If extension is not supported

Submodules