Filter and Vectorize Discrete Raster service specifications
Service Description
The Filter and Vectorize Discrete Raster (FilterVectorize) on-demand service provides the options to Filter and/or Vectorize a discrete raster. The service can be used for post-processing the products obtained from an on-demand service to remove isolated pixels, or noise, from the classification output. Typical post-classification workflow consists of filtering a classified raster (e.g. a binary mask from a change detection service) for the purpose to make the classified raster smoother and simplify its conversion to polygon vector.

The service has 3 possible execution modes:
-
Filter: applies only a spatial filter of input classified raster
-
Vectorize: converts only to vector the input classified raster
-
Filter and Vectorize: employs first spatial filtering on input classified raster and later does the conversion of the filtered raster into vector.
Input of the FilterVectorize is a classified single band raster. Service output depends on the execution mode and is made of filtered discrete raster and or a polygon vector.
Filter
Filter employs the Sieve algorithm to filter clusters of pixels having size smaller than a provided threshold (size as number of pixels) and replaces them with the pixel value of the largest neighbour polygon. The Sieve spatial filter is often used to simplify a classified image having a large amount of small areas. When filtering a classified image (e.g. unsupervised classified map from K-means or a binary change mask from CVA) the Sieve filter removes isolated classified pixels using blob grouping and keeps only clusters of contiguous pixels above the minimal area unit. The spatial filtering of input raster is built with the GDAL Sieve utility1.
Vectorize
Vectorize creates vector polygons for all connected regions of pixels in the raster sharing a common pixel value. Vector polygons are made by grouping adjoining pixels that were assigned to a feature or a class in the classified raster. The service allows the user to select the discrete raster values to be polygonized. This step is based on the GDAL Polygonize utility2.
Warning
Avoid converting noisy or large rasters with Vectorize. When possible, subset your classified image into a smaller AOI or employ a sufficient spatial filtering on it. A conversion of a large or noisy raster may result into a very large vector file (tens or hundreds of Mb) which is difficult to be handled inside or outside the platform (e.g. in a GIS software).
Note
This service can be used only with classified rasters (with a limited number of pixel values).
Input
Input of the FilterVectorize is a single band asset representing a classified raster (e.g. a binary mask from a change detection service).
Parameters
The FilterVectorize service requires a specified number of mandatory and optional parameters. The list of service parameters are listed in the table below.
| Parameter | Description | Required | Default value |
|---|---|---|---|
| Input discrete raster | Input product reference to discrete single band asset (e.g. a binary change mask or a classification map) | YES | |
| Service mode | The service has 3 possible modes: Filter, Vectorize, Filter and Vectorize. | YES | Filter |
| Filter threshold | Filter out from raster clusters of pixels smaller than a provided threshold. Threshold as cluster size in pixels (e.g. 10 means filtering clusters made of up to 10 pixels). Only for "Filter" or "Filter and Vectorize" modes. |
YES* | |
| Raster discrete values list to vectorize | Insert here a single (e.g. 1) or a list (1,2) of DN values to vectorize |
NO |
Table 1 - Parameters of the FilterVectorize processor.
Warning
The Filter threshold parameter is mandatory only for Filter and Filter and Vectorize modes. To be left blank in the Vectorize mode.
Input discrete raster
This asset must come from discrete raster. Discrete rasters are either binary mask or classification images with discrete DN values (e.g. 0,1,2,3) such as:
-
cloud masks 0=no-clouds, 1=clouds,
-
binary change maps 0=no-change, 1=change,
-
classification maps into N classes 0=class_1, 1=class_2, 2=class_3, etc. (Land cover).
Service mode
In this mandatory parameter the user shall select one of the 3 possible execution modes: Filter, Vectorize, Filter and Vectorize.
Filter threshold
In this parameter the user shall specify a threshold size in pixels (e.g. 10 pixels) to be used in the Sieve Spatial Filtering. As an example 10 means filtering clusters of pixels having size up to 10 pixels.
-
Minimum value:
0-> raster is not filtered at all. -
Default:
10-> reasonable value -
Maximum:
N-> there is not a maximum. The higher the number is the bigger is the aggregated number of class clusters
Note
Threshold value shall be a positive integer number.
Warning
Only for Filter or Filter and Vectorize modes.
Raster discrete values list to vectorize (optional)
With this last optional parameter the user can define what are the DN values to be considered when converting the raster to vector. Such values shall be inserted as a list of comma-separaed positive integers (e.g. 1,2 to have only these raster DNs converted to polygons).
Note
Inserted Values shall be >= the minimum and <= the maximum of single band asset values.
Warning
Only for Vectorize or Filter and Vectorize modes.
Output
According to the chosen execution mode, the FilterVectorize processor can provide as output the following products:
-
In the Filter mode the output is a STAC Item with a single band asset representing the filtered raster in COG format.
-
In the Vectorize mode the output is the converted polygon vector in GeoJSON (
.json)3 format. -
In Filter and Vectorize mode the service generates both raster and vector outputs.
FilterVectorize Product Specifications can be found in the below tables.
| Attribute | Value / description |
|---|---|
| Description | Filtered classified raster |
| File Name | filtered |
| Geospatial Data Type | Raster |
| Data Type | Native (e.g. 8bit) |
| Band | 1 |
| Format | COG |
| Projection | Native |
| Fill Value | Native (e.g. 0 for binary mask) |
| Attribute | Value / description |
|---|---|
| Description | Polygon vector converted from input filtered or not filtered single band classified raster |
| Short Name | result |
| Geospatial Data Type | Vector |
| Vector Data Type | Polygon |
| Feature properties | DN values of source raster |
| Format | GeoJson |
| Projection | EPSG:3857 - WGS 84 / Pseudo-Mercator |
Service Provider
The service is developed by Terradue.
References
-
GDAL Sieve Filter and its implementation in QGIS software, GDAL documentation, available at https://gdal.org and at https://docs.qgis.org. ↩
-
GDAL Polygonize and its implementation in QGIS software, GDAL documentation, available at https://gdal.org and at https://docs.qgis.org. ↩
-
GeoJSON, a format for encoding a variety of geographic data structures. Available at: https://geojson.org/. ↩