Class: QgsSunPositionCalculator¶
Calculates the sun’s position and related sun events for a given datetime.
This class is a high-level wrapper around the freespa algorithm for calculating solar position and events.
Warning
This class only supports sun position calculation from the Earth. Other celestial bodies are not supported.
Added in version 4.2.
List of all members, including inherited members
Static Methods
Calculates the solar position and events for a given point and time. |
- class qgis.core.QgsSunPositionCalculator[source]¶
Bases:
object- static calculate(point: QgsPointXY, crs: QgsCoordinateReferenceSystem, context: QgsCoordinateTransformContext, dateTime: QDateTime | datetime.datetime, elevationMeters: float = 0, pressure: float = 1013.25, temperature: float = 15) QgsSunPositionResult[source]¶
Calculates the solar position and events for a given point and time.
- Parameters:
point (QgsPointXY) – the target point in the specified
crs.crs (QgsCoordinateReferenceSystem) – Coordinate Reference System associated with the
point.context (QgsCoordinateTransformContext) – coordinate transform context.
dateTime (Union[QDateTime, datetime.datetime]) – the date and time for the calculation.
elevationMeters (float = 0) – optional elevation of the observer in meters above sea level.
pressure (float = 1013.25) – atmospheric pressure used for refraction correction (in millibars, hPa). The default is one standard atmosphere, or 1013.25 hPa.
temperature (float = 15) – the local temperature used for refraction correction, in degrees Celsius.
- Return type:
- Returns:
A
QgsSunPositionResultcontaining the calculated solar angles and event times.
Warning
This method only supports sun position calculation from the Earth. Other celestial bodies are not supported.
- Raises:
QgsCsException – if the point could not be transformed to WGS84
QgsInvalidArgumentException – when the specified arguments are invalid