FilterVectorize service specifications
The Filter and Vectorize Discrete Raster (FilterVectorize) is an asset based service that 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.
Figure 1 - K-Means unsupervised classification (3 class) from dual pol Sentinel-1 GRD calibrated data acquired over Lokoja, Nigeria during the Oct 2022 flood event. Results after spatial filtering and conversion to 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 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
CLASSIFIED IMAGE BEFORE FILTERING
Figure 2 - Classified raster from the K-means Unsupervised classifier (K-Means) service using a pair of dual-pol Sentinel-1 GRD calibrated datasets.
CLASSIFIED IMAGE AFTER FILTERING
Figure 3 - Filtered K-Means classified raster using the Sieve spatial filter with a size threshold of 10 pixels.
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
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).
This service can be used only with classified rasters (with a limited number of pixel values).
Figure 4 - Polygon vector derived from a binary change mask obtained with the Change Vector Analysis (CVA) service.
Shape and size of the resulting polygons depends on the pixel size of the input raster.
If you scale a raster feature with a zoom out in the map, it will lose quality and look more blurry/pixilated since an interpolation method (nearest neighbour, average, etc.) is employed. Instead, a vector feature can be scaled to any size without losing quality and thus always printed out in the map clearly.
A maximum and minimum zoom level is set when visualizing a vector feature in the map.
Input of the FilterVectorize is a single band asset representing a classified raster (e.g. unsupervised classified map from K-means or a binary map from HOTSPOT, CVA, IRIS, IRMAD or HASARD Single or Dual Image).
The FilterVectorize service requires a specified number of mandatory and optional parameters. The list of service parameters are listed in the table below.
|Input discrete raster
|Input product reference to discrete single band asset (e.g. a binary change mask or a classification map)
|The service has 3 possible modes: Filter, Vectorize, Filter and Vectorize.
|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.
|Raster discrete values list to vectorize
|Insert here a single (e.g.
1) or a list (
1,2) of DN values to vectorize
Table 1 - Service parameters for the FilterVectorize processor.
The Filter threshold parameter is mandatory only for
Filter and Vectorize modes. To be left blank in the
Input discrete raster
Product reference to the input single-band asset. This asset must come from discrete data (e.g. a raster representing a classified image map into classes). Examples of input single-band assets are unsupervised classified maps from K-Means or binary maps from HOTSPOT, CVA, HASARD Dual Image, HASARD Single Image, IRIS, IRMAD, or S2-Cloudless. It represents the source raster file from which polygons are derived. Being the service conceived to work only with single-band assets, the first band is used to build the polygons from.
Discrete rasters are either binary mask or classification images with discrete DN values (e.g. 0,1,2,3). Currently this type of raster is offered in the ESA Charter Mapper as single-band assets for:
cloud masks 0=no-clouds, 1=clouds (CLM binary mask from S2-Cloudless),
binary change maps 0=no-change, 1=change (
classification maps into N classes 0=class_1, 1=class_2, 2=class_3, etc. (
Thus admitted inputs are only certain single band asset as the ones listed below:
cva_change_detectionasset from CVA service (more details here),
flood-maskasset from HASARD Dual Image service (more details here),
hotspotasset from HOTSPOT service (more details here),
Kmeans_unsupervised_classifierasset from K-means service (more details here),
iris-change-maskasset from IRIS service (more details here),
irmad_change_detectionasset from IRMAD service (more details here),
s2cloudless_clmasset from S2-Cloudless service (more details here).
In this mandatory parameter the user shall select one of the 3 possible execution modes: Filter, Vectorize, Filter and Vectorize.
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.
0-> raster is not filtered at all.
10-> reasonable value
N-> there is not a maximum. The higher the number is the bigger is the aggregated number of class clusters
Threshold value shall be a positive integer number.
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).
Inserted Values shall be >= the minimum and <= the maximum of single band asset values.
Only for Vectorize or Filter and Vectorize modes.
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 Filter and Vectorize mode the service generates both raster and vector outputs.
FilterVectorize Product Specifications can be found in the below tables.
|Value / description
|Filtered classified raster
|Geospatial Data Type
|Native (e.g. 8bit)
|Native (e.g. 0 for binary mask)
|Value / description
|Polygon vector converted from input filtered or not filtered single band classified raster
|Geospatial Data Type
|Vector Data Type
|DN values of source raster
|EPSG:3857 - WGS 84 / Pseudo-Mercator
FlatGeoBuf A performant binary encoding for geographic data based on flatbuffers that can hold a collection of Simple Features including circular interpolations as defined by SQL-MM Part 3. Available at: https://flatgeobuf.org/. ↩