Image Bands API
Render API designed to render a slippy map XYZ raster tile a for a given scene. Tile resolution is 256x256 pixels by default.
- with Google map - https://jsfiddle.net/62jzLopc/
- with Mapbox - https://jsfiddle.net/qp3vxfwa/
Sentinel-2 True Color
https://api-connect.eos.com/api/render/S2/36/U/XU/2016/5/2/0/B04,B03,B02/10/611/354?api_key=<your_api_key>
HTTP Request
GET https://api-connect.eos.com/api/render/<view_id>/<bands>/<z>/<x>/<y>?api_key=<your api key>
Parameters
Parameter | Value example | Description |
---|---|---|
view_id | S2/36/U/XU/2016/5/2/0 | View id of a scene retrieved from the Search API |
bands | B04,B03,B02 | band combination expression. (see name aliases) |
z | 10 | Zoom level according to slippy map tilenames |
x | 611 | X coordinate according to slippy map tilenames |
y | 354 | Y coordinate according to slippy map tilenames |
About XYZ, there are python scripts in the wiki article, which can be used for converting lat, long into x and y, z = zoom level
Lon./lat. to tile numbers:
import math
def deg2num(lat_deg, lon_deg, zoom):
lat_rad = math.radians(lat_deg)
n = 2.0 ** zoom
xtile = int((lon_deg + 180.0) / 360.0 * n)
ytile = int((1.0 - math.asinh(math.tan(lat_rad)) / math.pi) / 2.0 * n)
return (xtile, ytile)
print(deg2num(-122.074413,39.512815,14))
Tile numbers to lon./lat.:
import math
def num2deg(xtile, ytile, zoom):
n = 2.0 ** zoom
lon_deg = xtile / n * 360.0 - 180.0
lat_rad = math.atan(math.sinh(math.pi * (1 - 2 * ytile / n)))
lat_deg = math.degrees(lat_rad)
return (lat_deg, lon_deg)
print(num2deg(4894,2839,13))
Query parameters
Parameter | Description |
---|---|
api_key | (Required) Apikey retrieved from developer portal |
MIN_MAX | (optional) list of comma separated min,max values for contrast stretching. Default: calculated by cumulative count cut algorithm with 2%-98% range and cloud correction. |
COLORS | (optional, only used in pair with THRESHOLDS) (for bandmath and grayscale only) list of comma separated color-hexes, which are used for colorization in pair with THRESHOLDS. Note: has to contain 1 more value than THRESHOLDS. (See Range colorization) |
THRESHOLDS | (optional, only used in pair with COLORS) (for bandmath and grayscale only) list of comma separated values of color thresholds, which are used for colorization in pair with COLORS. Note: has to contain 1 less value than COLORS. (See Range colorization) |
crs | (optional) output tile projection. Default: “EPSG:3857” |
CALIBRATE | (optional) (for bandmath only) unique parameter for BandMath – if True (or 1), converts band data to ToA Reflectance (or to At-Satellite Brightness Temperature for TIRS) prior to performing the band math |
COLORMAP | (optional) (for bandmath and grayscale only) bandmath colorization with the specified colormap. MIN_MAX can be applied with this query param. (See Colormap API ) |
COLORS_LIMIT | (optional) count of colors for continuous colormaps (See Colormap API) |
cropper_ref | (optional) AOI reference from Cropper API; any image data that does not fall into AOI is made transparent. |
RESAMPLE | (optional) interpolation type (‘near’, ‘bilinear’, ‘cubic’, ‘cubicspline’, ‘lanczos’, ‘average’, ‘mode’, ‘max’, ‘min’, ‘med’, ‘q1’, ‘q3’) |
mimetype | (optional) output image type (‘image/jpeg’, ‘image/png’). Default: ‘image/jpeg’ for not transparent tiles; ‘image/png’ for tiles with transparency |
PALETTE | (optional) dictionary with bit numbers (1 bit number or 2 as a tuple) as keys and colors (in form of RGB or hex) as values. If in any given pixel some bits have value 1, it’s set to corresponding color from the palette. If bits don’t have a color tied to them in the palette, pixels are made transparent. Without this parameter BQA is colorized with default palette (See Palette) |
PANSHARPENING | (optional) performs pansharpening of a given band combination if True (or 1). This option is supported for Landsat-8 and Landsat-7 only |
Multispectral Tile
Every sensor is equipped to handle a specific set of multispectral bands. The Render API accommodates either single-band (grayscale) or three-band (multichannel) configurations. Each sensor has designated band names, and to simplify usage, we have included name aliases.
Visualize a band combination (RGB Mapping)
Sentinel-2 True Color
https://api-connect.eos.com/api/render/S2/36/U/XU/2016/5/2/0/B04,B03,B02/10/611/354?api_key=<your_api_key>
Sentinel-2 False Color Image
https://api-connect.eos.com/api/render/S2/36/U/XU/2016/5/2/0/B08,B04,B03/10/611/354?api_key=<your_api_key>
Sentinel-1 - RGB Mapping of bands VV,VH,VV
https://api-connect.eos.com/api/render/S1/S1A_IW_GRDH_1SDV_20230502T230021_20230502T230046_048361_05D10E_2958/VH,VH,VV/12/3215/1838?api_key=<your_api_key>
Sentinel-2 - NDVI
https://api-connect.eos.com/api/render/S2/36/U/XU/2016/5/2/0/NDVI/10/611/354?api_key=<your_api_key>
Sentinel-2 NDVI - Clustering
https://api-connect.eos.com/api/render/S2/36/U/XU/2016/5/2/0/NDVI/10/611/354?CALIBRATE=1&CLUSTERING=kmeans&CLUSTERS_NO=5&MIN_AREA=2000&api_key=<your_api_key>
Virtual band tile
Virtual Band tile can be requested in the same way as any other web tile (See Multispectral tiles). The only difference is in a band combination expression. Instead of just one or three bands (B3 or B4,B3,B2) bandmath expressions can be specified (B5-B4/B5+B4 or B5-B4/B5+B4,B6+B4/B5,sqrt(B4)).
It is possible to request either single Virtual Band and apply query parameters PALETTE/THRESHOLDS or COLORMAP/MIN_MAX, or RGB composite by specifying three Virtual Band expressions separated with coma and applying query parameter COMPOSITE=1. See Supported basic operators for list of supported operators. An output array has Float32 dtype, so its pixel values lay in range +-3.4028235e+38. Everything out of this range will be black or white respectively.
HTTP Request
GET https://api-connect.eos.com/api/render/<view_id>/<bands>/<z>/<x>/<y>?api_key=<your api key>
Query parameters
Parameters are the same as for Multispectral Tile
Examples
Visualize Virtual Band as combination of 3 bands (RGB mapping)
https://api-connect.eos.com/api/render/S2/36/U/XU/2016/5/2/0/NDVI,NDSI,NDWI/10/611/354?&api_key=<your_api_key>
Transparency alias
You can use NODATA alias in Virtual Band expressions to make some pixels transparent, if their value matches some condition.
Here’s an example where all pixels are either made transparent or rendered as NDVI depending of whether or not they match the condition:
https://api-connect.eos.com/api/render/S2/36/U/XU/2016/5/2/0/where(NDWI>0,NODATA,NDVI)/10/611/354?&api_key=<your_api_key>
Fire detection tile
Generate a slippy map XYZ fire detection raster tile for a given Sentinel-2 scene. Tiles are 256x256 pixels. Band combination used is FIDET formula (see Name Aliases). Second scene for comparison is determined automatically; if there is no suitable scene, transparent tiles are returned.
Forestry cover mask is applied - pixels that don’t contain trees are made transparent.
Sentinel-2 fire detection
https://api-connect.eos.com/api/render/S2/36/U/XU/2016/5/2/0/PR_FD/10/611/354?&api_key=<your_api_key>