def __get_color_ramp_items(renderer: QgsRasterRenderer, provider: QgsRasterDataProvider, color: QtGui.QColor) -> List[ QgsColorRampShader.ColorRampItem]: bands = renderer.usesBands() band_statistics = provider.bandStatistics(bands[0], QgsRasterBandStats.All) minValue = band_statistics.minimumValue maxValue = band_statistics.maximumValue min_color = QtGui.QColor(color) min_color.setAlpha(0) max_color = QtGui.QColor(color) max_color.setAlpha(255) return [ QgsColorRampShader.ColorRampItem(minValue, min_color), QgsColorRampShader.ColorRampItem(maxValue, max_color), ]
def capabilities(self): caps = QgsRasterInterface.Size | QgsRasterInterface.Identify | QgsRasterInterface.IdentifyValue return QgsRasterDataProvider.ProviderCapabilities(caps)
def from_numpy(x, **opt): ras = QgsRasterLayer() dp = QgsRasterDataProvider() ras.setDataProvider(dp)