The ClassHistogram is a plot operator that computes a histogram plot either over categorical attributes of a vector dataset or categorical values of a raster source. The output is a plot in Vega-Lite specification.

For instance, you want to plot the frequencies of the classes of a categorical attribute of a feature collection. Then you can use a class histogram to visualize and assess this.


ParameterTypeDescriptionExample Value
columnNamestring (optional)The name of the attribute making up the x-axis of the histogram. Must be set for a vector sources, must not be set for rasters."temperature"


The operator consumes either one vector or one raster operator.



The operator returns an error if…

  • the selected column (columnName) does not exist or is not numeric,
  • the source is a raster and the property columnName is set, or
  • the input Measurement is not categorical.

The operator returns an error if


The operator only uses values of the categorical Measurement. It ignores missing or no-data values and values that are not covered by the Measurement.

Example JSON

  "type": "ClassHistogram",
  "params": {
    "columnName": "foobar"
  "sources": {
    "vector": {
      "type": "OgrSource",
      "params": {
        "data": "ndvi"