跳转至
🎉 Apache Sedona 1.9.1 已正式发布!🗺️ 新增 Geography SQL 函数、Box2D 与 Box3D 类型、栅格 Python UDF 等。查看发布说明 →

RS_Count

Introduction: Returns the number of pixels in a given band. If band is not specified then it defaults to 1.

Note

If excludeNoDataValue is set true then it will only count pixels with value not equal to the nodata value of the raster. Set excludeNoDataValue to false to get count of all pixels in raster.

Note

If the mentioned band index doesn't exist, this will throw an IllegalArgumentException.

Format:

RS_Count(raster: Raster)

RS_Count(raster: Raster, band: Integer = 1)

RS_Count(raster: Raster, band: Integer = 1, excludeNoDataValue: Boolean = true)

Return type: Long

Since: v1.5.0

SQL Example

SELECT RS_Count(RS_MakeEmptyRaster(2, 5, 5, 0, 0, 1, -1, 0, 0, 0), 1, false)

Output:

25

SQL Example

SELECT RS_Count(RS_MakeEmptyRaster(2, 5, 5, 0, 0, 1, -1, 0, 0, 0), 1)

Output:

6