Skip to main content

Colorization API

Default colormap colorization​

Colormap is an array of colors used to map pixel data (represented as indices in the color table) to the actual color values. Default colormaps from Matplotlib can be used (Accent, viridis, Purples, winter etc., also see Choosing Colormaps).

Example of Render Sentinel2 image with NDSI index and viridis colormap:

https://api-connect.eos.com/api/render/S2/36/U/XU/2016/5/2/0/NDSI/10/611/354?COLORMAP=viridis&api_key=<your_api_key>

Render Sentinel2 image with NDSI index and viridis colormap

To check the list of all available colormaps use:

HTTP Request​

GET `https://api-connect.eos.com/api/render/colormap/ALL?api_key=<your_api_key>`

Request Parameters​

Request Path ParameterValueDescription
api_key<your_api_key>(Required) Apikey retrieved from developer portal
INCLUDE_TYPE[true, false](bool) return information about colormap as object {name: type}; default - false
TYPE[β€œcontinuous”, β€œdiscrete”]filtering colormap list in response by type; default - without filtering (all colormaps)

The resulting colormap value is used in Download requests to obtain images.

For example, you can try to use an example for download visual

Read more about colormaps

Read more about predefined colormaps on Matplotlib portal

Examples for colormap request​

Example 1 - Request without additional parameters

Example 2 - Request with the additional parameter TYPE

Example 3 - Request with the additional parameters INCLUDE TYPE and TYPE

Example 1​

Request without additional parameters

curl --location --request GET 'https://api-connect.eos.com/api/render/colormap/ALL?api_key=<your_api_key>'

Response

{
"colormap_list": [
"Accent",
"Accent_r",
"Blues",
"Blues_r",
"BrBG",
"BrBG_r",
"BuGn",
"BuGn_r",
"BuPu",
"BuPu_r",
"CMRmap",
"CMRmap_r",
"Dark2",
"Dark2_r",
"GnBu",
"GnBu_r",
"Greens",
"Greens_r",
"Greys",
"Greys_r",
"OrRd",
"OrRd_r",
"Oranges",
"Oranges_r",
"PRGn",
"PRGn_r",
"Paired",
"Paired_r",
"Pastel1",
"Pastel1_r",
"Pastel2",
"Pastel2_r",
"PiYG",
"PiYG_r",
"PuBu",
"PuBuGn",
"PuBuGn_r",
"PuBu_r",
"PuOr",
"PuOr_r",
"PuRd",
"PuRd_r",
"Purples",
"Purples_r",
"RdBu",
"RdBu_r",
"RdGy",
"RdGy_r",
"RdPu",
"RdPu_r",
"RdYlBu",
"RdYlBu_r",
"RdYlGn",
"RdYlGn_r",
"Reds",
"Reds_r",
"Set1",
"Set1_r",
"Set2",
"Set2_r",
"Set3",
"Set3_r",
"Spectral",
"Spectral_r",
"Wistia",
"Wistia_r",
"YlGn",
"YlGnBu",
"YlGnBu_r",
"YlGn_r",
"YlOrBr",
"YlOrBr_r",
"YlOrRd",
"YlOrRd_r",
"afmhot",
"afmhot_r",
"autumn",
"autumn_r",
"binary",
"binary_r",
"bone",
"bone_r",
"brg",
"brg_r",
"bwr",
"bwr_r",
"cividis",
"cividis_r",
"cool",
"cool_r",
"coolwarm",
"coolwarm_r",
"copper",
"copper_r",
"cubehelix",
"cubehelix_r",
"flag",
"flag_r",
"gist_earth",
"gist_earth_r",
"gist_gray",
"gist_gray_r",
"gist_heat",
"gist_heat_r",
"gist_ncar",
"gist_ncar_r",
"gist_rainbow",
"gist_rainbow_r",
"gist_stern",
"gist_stern_r",
"gist_yarg",
"gist_yarg_r",
"gnuplot",
"gnuplot2",
"gnuplot2_r",
"gnuplot_r",
"gray",
"gray_r",
"hot",
"hot_r",
"hsv",
"hsv_r",
"inferno",
"inferno_r",
"jet",
"jet_r",
"magma",
"magma_r",
"nipy_spectral",
"nipy_spectral_r",
"ocean",
"ocean_r",
"pink",
"pink_r",
"plasma",
"plasma_r",
"prism",
"prism_r",
"rainbow",
"rainbow_r",
"seismic",
"seismic_r",
"spring",
"spring_r",
"summer",
"summer_r",
"tab10",
"tab10_r",
"tab20",
"tab20_r",
"tab20b",
"tab20b_r",
"tab20c",
"tab20c_r",
"terrain",
"terrain_r",
"twilight",
"twilight_r",
"twilight_shifted",
"twilight_shifted_r",
"viridis",
"viridis_r",
"winter",
"winter_r"
]
}

Example 2​

Request with the additional parameter TYPE

curl --location --request GET 'https://api-connect.eos.com/api/render/colormap/ALL?TYPE=continuous&api_key=<your_api_key>'

Response

{
"colormap_list": [
"gist_stern",
"PuOr",
"GnBu",
"YlOrRd_r",
"plasma_r",
"RdGy_r",
"twilight_r",
"PuBu",
"gnuplot",
"bone_r",
"PuRd",
"Purples",
"coolwarm",
"CMRmap_r",
"YlGnBu",
"hot_r",
"RdYlBu",
"summer_r",
"viridis_r",
"BrBG_r",
"Oranges_r",
"magma",
"gist_yarg",
"gray_r",
"flag",
"brg",
"coolwarm_r",
"gist_heat_r",
"Wistia_r",
"hsv_r",
"afmhot",
"gnuplot2",
"jet_r",
"twilight_shifted_r",
"BuGn",
"BuGn_r",
"YlGn_r",
"PuBuGn_r",
"Reds",
"GnBu_r",
"binary_r",
"Greys_r",
"Wistia",
"cool",
"gray",
"terrain_r",
"RdYlGn",
"PiYG",
"BrBG",
"PuRd_r",
"cubehelix_r",
"PRGn",
"Blues_r",
"autumn_r",
"Purples_r",
"nipy_spectral_r",
"PuBuGn",
"PuBu_r",
"RdYlBu_r",
"cividis_r",
"hsv",
"RdBu_r",
"YlOrBr_r",
"gist_stern_r",
"inferno_r",
"cool_r",
"plasma",
"Oranges",
"inferno",
"CMRmap",
"copper_r",
"seismic",
"gist_ncar_r",
"YlOrRd",
"spring_r",
"gnuplot_r",
"YlOrBr",
"gist_earth_r",
"prism",
"OrRd",
"terrain",
"gist_ncar",
"seismic_r",
"RdGy",
"YlGnBu_r",
"binary",
"cividis",
"autumn",
"gnuplot2_r",
"RdPu_r",
"magma_r",
"RdYlGn_r",
"RdBu",
"bone",
"twilight",
"twilight_shifted",
"rainbow",
"copper",
"gist_yarg_r",
"viridis",
"gist_gray",
"Greys",
"gist_gray_r",
"summer",
"Greens_r",
"bwr_r",
"OrRd_r",
"pink",
"ocean_r",
"winter_r",
"PRGn_r",
"Reds_r",
"bwr",
"gist_earth",
"pink_r",
"PuOr_r",
"hot",
"ocean",
"rainbow_r",
"YlGn",
"flag_r",
"Greens",
"Spectral_r",
"gist_heat",
"cubehelix",
"prism_r",
"RdPu",
"Spectral",
"spring",
"BuPu_r",
"PiYG_r",
"afmhot_r",
"nipy_spectral",
"winter",
"BuPu",
"gist_rainbow_r",
"Blues",
"jet",
"gist_rainbow",
"brg_r"
]
}

Example 3​

Request with the additional parameters INCLUDE TYPE and TYPE

curl --location --request GET 'https://api-connect.eos.com/api/render/colormap/ALL?INCLUDE_TYPE=1&TYPE=discrete&api_key=<your_api_key>'

Response

{
"colormap_list": [
{ "Accent": "discrete" },
{ "Accent_r": "discrete" },
{ "Dark2": "discrete" },
{ "Dark2_r": "discrete" },
{ "Paired": "discrete" },
{ "Paired_r": "discrete" },
{ "Pastel1": "discrete" },
{ "Pastel1_r": "discrete" },
{ "Pastel2": "discrete" },
{ "Pastel2_r": "discrete" },
{ "Set1": "discrete" },
{ "Set1_r": "discrete" },
{ "Set2": "discrete" },
{ "Set2_r": "discrete" },
{ "Set3": "discrete" },
{ "Set3_r": "discrete" },
{ "Vega10": "discrete" },
{ "Vega10_r": "discrete" },
{ "Vega20": "discrete" },
{ "Vega20_r": "discrete" },
{ "Vega20b": "discrete" },
{ "Vega20b_r": "discrete" },
{ "Vega20c": "discrete" },
{ "Vega20c_r": "discrete" },
{ "tab10": "discrete" },
{ "tab10_r": "discrete" },
{ "tab20": "discrete" },
{ "tab20_r": "discrete" },
{ "tab20b": "discrete" },
{ "tab20b_r": "discrete" },
{ "tab20c": "discrete" },
{ "tab20c_r": "discrete" }
]
}

Predefined colormaps​

You can use these colormaps:

NDVI: colormap_id:a9bc6eceeef2a13bb88a7f641dca3aa0, levels:-1,1

NDRE - colormap_id:a9bc6eceeef2a13bb88a7f641dca3aa0&MIN_MAX=-1.0,1.0

MSAVI - colormap_id:5792d8fc39a4598f8a2c67b300982076&MIN_MAX=-1,1

NDMI - colormap_id:a53f2c53d3cbc1d424c35ac8dc883644&MIN_MAX=-1,1

1. For getting NDVI data you can use​

"colormap": "a9bc6eceeef2a13bb88a7f641dca3aa0" 

"levels": "-1,1"

NDVI colormap example

{
"colors": [
[
-1.0,
"#ad0028"
],
[
0.05,
"#c5142a"
],
[
0.1,
"#e02d2c"
],
[
0.15,
"#ef4c3a"
],
[
0.2,
"#fe6c4a"
],
[
0.25,
"#ff8d5a"
],
[
0.3,
"#ffab69"
],
[
0.35,
"#ffc67d"
],
[
0.4,
"#ffe093"
],
[
0.45,
"#ffefab"
],
[
0.5,
"#fdfec2"
],
[
0.55,
"#eaf7ac"
],
[
0.6,
"#d5ef94"
],
[
0.65,
"#b9e383"
],
[
0.7,
"#9bd873"
],
[
0.75,
"#77ca6f"
],
[
0.8,
"#53bd6b"
],
[
0.85,
"#14aa60"
],
[
0.9,
"#009755"
],
[
0.95,
"#007e47"
],
[
1.0,
"#007e47"
]
],
"type": "discrete",
"thresholds_type": "absolute",
"colors_quantity": 21
}

2. For getting MSAVI data you can use​

"colormap": "5792d8fc39a4598f8a2c67b300982076"
"levels": "-1,1"

MSAVI colormap example

{
"colors": [
[
-1.0,
"#ad0028"
],
[
0.0,
"#fe6c4a"
],
[
0.02,
"#ff8d5a"
],
[
0.04,
"#ffab69"
],
[
0.06,
"#ffc67d"
],
[
0.08,
"#ffe093"
],
[
0.1,
"#ffefab"
],
[
0.12,
"#fdfec2"
],
[
0.15,
"#eaf7ac"
],
[
0.17,
"#d5ef94"
],
[
0.2,
"#b9e383"
],
[
0.22,
"#9bd873"
],
[
0.25,
"#77ca6f"
],
[
0.27,
"#53bd6b"
],
[
0.3,
"#14aa60"
],
[
0.35,
"#009755"
],
[
0.4,
"#007e47"
],
[
0.5,
"#00673a"
],
[
0.6,
"#005530"
],
[
0.7,
"#004728"
],
[
1.0,
"#004728"
]
],
"type": "discrete",
"thresholds_type": "absolute",
"colors_quantity": 21
}

3. For getting RECI data you can use​

 "colormap": "fb5d32c26f571d52ea663a4a8f1e38e0"
"levels": "0,10"

RECI colormap example

{
"colors": [
[
0.0,
"#a50026"
],
[
0.5,
"#bc1626"
],
[
1.0,
"#d62f26"
],
[
1.5,
"#e54d34"
],
[
2.0,
"#f46d43"
],
[
2.5,
"#f88e52"
],
[
3.0,
"#fcac60"
],
[
3.5,
"#fdc675"
],
[
4.0,
"#fee08b"
],
[
4.5,
"#feefa5"
],
[
5.0,
"#fefebd"
],
[
5.5,
"#ecf7a5"
],
[
6.0,
"#d9ef8b"
],
[
6.5,
"#bfe37a"
],
[
7.0,
"#a4d869"
],
[
7.5,
"#84ca66"
],
[
8.0,
"#66bd63"
],
[
8.5,
"#3faa59"
],
[
9.0,
"#19974f"
],
[
9.5,
"#0c7e42"
],
[
10.0,
"#0c7e42"
]
],
"type": "discrete",
"thresholds_type": "absolute",
"colors_quantity": 21
}

5. For getting NDMI data you can use​

"colormap": "a53f2c53d3cbc1d424c35ac8dc883644"
"levels": "0,1"

NDMI colormap example

{
"colors": [
[
-1,
"#af998c"
],
[
-0.9,
"#b49e95"
],
[
-0.8,
"#baa49e"
],
[
-0.7,
"#bfaaa8"
],
[
-0.6,
"#c5b0b2"
],
[
-0.5,
"#cbb6bc"
],
[
-0.4,
"#d0bbc5"
],
[
-0.3,
"#d6c1cf"
],
[
-0.2,
"#cbb9d2"
],
[
-0.1,
"#baadd3"
],
[
0,
"#a8a0d5"
],
[
0.1,
"#9894d6"
],
[
0.2,
"#8788d7"
],
[
0.3,
"#767bd8"
],
[
0.4,
"#646ed9"
],
[
0.5,
"#5362da"
],
[
0.6,
"#4356db"
],
[
0.7,
"#3249dc"
],
[
0.8,
"#213ddd"
],
[
0.9,
"#0f30de"
],
[
1,
"#0f30de"
]
],
"type": "discrete",
"thresholds_type": "absolute",
"colors_quantity": 21
}

Creating custom colormap​

For creating custom colormap, need provide to API list with colors.

List without positions: [color, color, color]

List with position: [[0.0, color], [position, color], [position, color], [1.0, color]]

Supported color formats:

  1. Hexadecimal string. Ex. : β€œ#f33a67”.
  2. RGB list, each band is in range 0..1. Ex.: [0.5, 0.7, 0.3].

By default, supported position is in range 0..1. First color should be in position 0.0, last - 1.0. User can also specify absolute values of position, in range which corresponds to min and max of a dataset to be colorized. In this case, thresholds_type parameter shall be set to β€œabsolute”:

Colormap mechanics explanation​

Continuous colormap with specified RGB colors [0.0, β€œ#ff0000”], [0.5, β€œ#00ff00”], [1.0, β€œ#0000ff”]. It has 256 colors

colorizaton

Discrete colormap with the same RGB colors:

colorizaton

For continious colormap there are 255 thresholds between 256 colors, so color value is changing monotonically, creating new intermediate colors between set colors and thresholds. Color positions stretch over input data range.

Custom colormap with absolute thresholds like [0, β€œ#ff9900”, 0.06, β€œ#ffcc00”, …., 1, β€œ#336600”] is applied as follows:

  1. The color is applied to pixels with the value from threshold-color pair and to all pixels with a value higher than specified up to the next specified threshold and color value, i.e. [0.52, β€œ#ff0000”, 0.7, β€œ#ffffff”] - the #ff0000 color is applied to all pixels in range 0.52 (including) - 0.7 (excluding).

  2. Π‘olors on the edges (first and last threshold-color pairs) are applied to all pixels with values outside the ranges specified by colormap - the color from the first pair with the lowest threshold value is applied to all pixels with values below the specified one. Likewise, the color from the last pair, with the highest specified threshold, is applied to all pixels with values above that threshold.

For colormap [0, β€œ#ff9900”, 0.06, β€œ#ffcc00”, 0.1, β€œ#ffff66”, 0.2, β€œ#ffff99”, 0.52, β€œ#ff0000”, 0.7, β€œ#ffffff”, 1, β€œ#336600”] color #ff9900 will be applied not only to pixel values in range 0 - 0.06, but also to those below 0. The color #336600 will be applied to all pixel values from 1 and higher. This is relevant for indices that have values outside the range -1..1, i.e. RECI.

If you want to create your own colormap, than the following API can be used:

HTTP Request​

POST 'https://api-connect.eos.com/api/render/colormap/?api_key=<your_api_key>' \
--header 'Content-Type: application/json' \
--data-raw '{
"colors": [[number, "color Hex Code"],
[number, "color Hex Code"],
.........................,
[number, "color Hex Code"]],
"type": "colormap_type"
}'

Request Parameters​

Request Path ParameterDescription
api_key(Required) Apikey retrieved from developer portal
Request Body ParameterDescription
colors(required) list of colormap colors
type(optional) colormap type [discrete or continuous],
by default - continuous
thresholds_type(optional) indicates if thresholds specified by user are relative, i.e. indicate percentage of an image minmax in range 0-1, or absolute.
By default - relative.
labels(optional) for discrete colormaps - list of names to pair with colors. Has to be same length as colors

HTTP Response​

The above request returns the following JSON with the colormap ID

{"id": "color identifier"}

Examples​

Request

curl --location --request POST 'https://api-connect.eos.com/api/render/colormap/?api_key=<your_api_key>' \
--header 'Content-Type: application/json' \
--data-raw '{
"colors": [[0.0, "#ff0000"],
[0.1, "#00ff00"],
[0.9, "#ff00ff"],
[1.0, "#0000ff"]],
"type": "continuous"
}'

Response

{"id": "435c34ac345084527cc712e382d8c082"}

Get information about colormap​

HTTP Request​

GET 'https://api-connect.eos.com/api/render/colormap/<colormap_id>?api_key=<your_api_key>'

Request Parameters

Request Path ParameterDescription
api_key(Required) Apikey retrieved from developer portal
colormap_id(Required) colormap ID

HTTP Response​

{
"colors": [
[
0.0,
"#ff0000"
],
[
0.1,
"#00ff00"
],
[
0.9,
"#ff00ff"
],
[
1.0,
"#0000ff"
]
],
"type": "continuous",
"thresholds_type": "relative",
"colors_quantity": 4
}

Response parameters​

ParameterDescription
colorslist of colormap colors
typecolormap type
thresholds_typeindicates of thresholds type
colors_quantitynumber of using colors

Examples​

request

curl --location --request GET 'https://api-connect.eos.com/api/render/colormap/435c34ac345084527cc712e382d8c082?api_key=<your_api_key>'

Response

{
"colors": [
[
0.0,
"#ff0000"
],
[
0.1,
"#00ff00"
],
[
0.9,
"#ff00ff"
],
[
1.0,
"#0000ff"
]
],
"type": "continuous",
"thresholds_type": "relative",
"colors_quantity": 4
}

Range colorization​

Range colorization (COLORS & THRESHOLDS) is used for single band data. Unlike colormap, range colorization specifies values of colors and thresholds strictly. This leads to following сonsequences:

1.No other colors appear (unlike in continuous colormaps), used colors are limited to those specified by COLORS.

2.Thresholds are applied as absolute values to input data.
For example: NDVI data varies in range -1..1, so THRESHOLDS also have to be in this range, ubyte-type data (0..255) requires corresponding THRESHOLDS values, i.e. 0,100,127,201 etc.

Example query like ?COLORS=000000,ffffff,c4baa4,b4966c,a4824c&THRESHOLDS=0,0.3,0.6,0.9 colorizes NDVI data in the following way: pixel values from -1 to 0 are colorized in 000000 color, from 0 to 0.3 in ffffff, from 0.3 to 0.6 in c4baa4, from 0.6 to 0.9 in b4966c, from 0.9 to 1 in a4824c color.

COLORS and THRESHOLDS are used only in pair.

COLORS are specified as string of hexadecimals, separated by commas without spaces. Ex.: β€œb4966c,a4824c”.

THRESHOLDS are specified as string of digits, separated by commas without spaces. Have to contain 1 less value than COLORS. Ex.: β€œ0.07,0.1”. THRESHOLDS must be specified in ascending order, from the lowest to the highest value. Ex.: β€œ-0.48,-0.36,-0.24,-0.12”.

note

Range colorization is used as default for NDVI, NDSI, NDWI.

Usage example​

Range colorization at Imagery API​

curl -i -X POST 'https://api-connect.eos.com/api/gdw/api?api_key=<your_api_key>' \
-H "Content-Type:application/json" \
-d \
'{
"type":"jpeg",
"params":{
"view_id":"S2/35/U/QR/2019/10/30/0",
"cropper_ref":"da2b157e9ab359f9d55ef7db38c8b7d2",
"bm_type":"(NIR-RED)/(NIR+RED)",
"name_alias":"ndre",
"reference":"21077010",
"px_size":5,
"calibrate":1,
"colors":[
"B40030",
"B00015",
"AC0500",
"A81F00",
"A43700",
"A04E00",
"9C6400",
"987900",
"948C00",
"819000",
"688C00",
"508800",
"3A8400",
"248000",
"107C00",
"007802",
"007413",
"007024",
"006C33",
"006842"
],
"thresholds":[
0.05,
0.11,
0.16,
0.2,
0.26,
0.32,
0.37,
0.42,
0.47,
0.53,
0.58,
0.63,
0.68,
0.74,
0.79,
0.84,
0.89,
0.95,
1
],
"format":"tiff"
}
}'