sec_interp.core.utils.io module

I/O Utilities Module.

File I/O operations and user messaging.

sec_interp.core.utils.io.create_shapefile_writer(output_path: str | Path, crs: qgis.core.QgsCoordinateReferenceSystem, fields: qgis.core.QgsFields, geometry_type: qgis.core.QgsWkbTypes.GeometryType = qgis.core.QgsWkbTypes.LineString) qgis.core.QgsVectorFileWriter

Create and initialize a QgsVectorFileWriter for Shapefiles.

Uses the modern create static method for QGIS 3.38+ compatibility.

Parameters:
  • output_path – File system path where the shapefile will be created.

  • crs – The Coordinate Reference System for the new file.

  • fields – The attribute fields definition.

  • geometry_type – The mapping geometry type (default: LineString).

Returns:

An initialized writer object for creating a Shapefile.

Raises:

OSError – If the writer cannot be created or has an initialization error.