sec_interp.gui.adapters.geometry_sampling module

Raster point/line sampling helpers for the Extract phase.

sec_interp.gui.adapters.geometry_sampling.sample_elevation_along_line(geometry: QgsGeometry, raster_layer: QgsRasterLayer, band_number: int, distance_area: QgsDistanceArea, reference_point: QgsPointXY | None = None, interval: float | None = None) → list[QgsPointXY]

Sample elevation values along a line geometry from a raster layer.

The sampling interval is the raster pixel size expressed in the section line’s CRS. When the line and raster CRSs differ (on-the-fly reprojection), the pixel size is transformed before use and each sample point is reprojected into the raster CRS.

sec_interp.gui.adapters.geometry_sampling.sample_point_elevation(raster_layer: QgsRasterLayer, point: Any, band_number: int = 1, source_crs: QgsCoordinateReferenceSystem | None = None) → float

Sample elevation from a raster layer at a 2D coordinate.

point may be a QgsPointXY or a (x, y) tuple. When source_crs differs from the raster CRS, the point is reprojected before sampling.