Class: Image

Image(params)

This is the Image class. Using this instance allows you to obtain the visualized result as an HTMLCanvasElement or retrieve the data as a numerical array.

Constructor

new Image(params)

Parameters:
Name Type Description
params Object Conditions for obtaining an Image instance
Properties
Name Type Description
imageCollection ImageCollection Instance of ImageCollection
See:

Methods

deleteData()

Deletes the initialization execution results. To retrieve data, you must execute Image#init again.

getBand() → {string}

Retrieves the name of the currently used band within the Image instance.
Returns:
Band name
Type
string

getBbox() → {BboxObject}

Acquire the latitude and longitude range of the images to be obtained.
Returns:
BboxObject representing a latitude and longitude range
Type
BboxObject

getCanvas() → {HTMLCanvasElement}

Returns the result of visualizing the data as a canvas element (HTMLCanvasElement). You can display it on the browser using methods such as `document.body.appendChild`. To display an image using the HTML img tag, set the image in DataURL format obtained from HTMLCanvasElement's toDataURL() to the src attribute of the img tag.
Returns:
HTMLCanvasElement for displaying visualization results as images in the browser
Type
HTMLCanvasElement

getColorMap() → {ColorMapObject}

Retrieve the color map used when converting an image into another image.
Returns:
ColorMapObject representing a color map
Type
ColorMapObject

getCoordinates(i, j) → {Object}

Acquires the latitude and longitude of the location (i, j) within the captured image.
Parameters:
Name Type Description
i number Horizontal pixel position. The left end corresponds to i=0, and the right end corresponds to i=width.
j number Vertical pixel position. The top edge corresponds to j=0, and the bottom edge corresponds to j=height.
Returns:
Returns the latitude and longitude values.
Type
Object

getData() → {DataObject}

Returns data. This includes data such as the image width and height, and the value of each pixel.
Returns:
Type
DataObject

getDate() → {Date}

Returns the date and time.
Returns:
Date representing the date and time
Type
Date

getFormattedDate() → {string}

Returns a date and time string based on the date and time format defined in the dataset (je:stac_date_format of each collection.json). For example, for monthly datasets, the format is YYYY/MM, and for daily datasets, the format is YYYY/MM/DD.
Returns:
Date and time string
Type
string

getHeight() → {number}

Gets the height (number of pixels) of the acquired image.
Returns:
Number of pixels in height
Type
number

getImageCollection() → {ImageCollection}

Retrieves the ImageCollection currently used within the Image instance.
Returns:
Type
ImageCollection

getLegend(width, height, fontSize) → {HTMLCanvasElement}

Returns the legend image of the color map as a canvas.
Parameters:
Name Type Description
width number Width of the legend image (number of pixels)
height number Height of legend image (number of pixels)
fontSize number Font size in legend image (number of pixels)
Returns:
HTMLCanvasElement for displaying the color map legend as an image in the browser
Type
HTMLCanvasElement

getMax() → {number}

Obtain the pixel value with the highest one in the data.
Returns:
highest value
Type
number

getMin() → {number}

Obtain the pixel value with the smallest one in the data.
Returns:
smallest value
Type
number

getStacItems() → {Array}

Returns the STAC Item used for data acquisition.
Returns:
List of STAC Item
Type
Array

getTid() → {string}

Returns the time ID of the STAC used for data acquisition.
Returns:
STAC timestamp ID
Type
string

getUnit() → {string}

Obtains the unit of the data. This is the value of the unit of je:rasters, defined in the Feature STAC.
Returns:
Returns the unit string.
Type
string

getValue(i, j) → {number}

Retrieves the value at the location (i, j) within the acquired image.
Parameters:
Name Type Description
i number Horizontal pixel position. The left edge is i=0, and the right edge is i=width.
j number Vertical pixel position. The top edge is j=0, and the bottom edge is j=height.
Returns:
Returns the value of the data.
Type
number

getWidth() → {number}

Obtains the width of the acquired image (in pixels).
Returns:
Number of pixels in width
Type
number

(async) init(onloadingopt, projectionopt)

Initializing. Since data will be obtained during this process, execution is mandatory.
Parameters:
Name Type Attributes Default Description
onloading Image~Image-onloading <optional>
function(){} This is a callback function that is executed while data is being retrieved. This function is invoked each time data is loaded for each tile unit of a COG file.
projection string <optional>
Projection method

ready() → {boolean}

Retrieves the status of the initialization process.
Returns:
If true, initialization is complete (Image#getData, Image#getCanvas and others can be executed.), if false, execution of Image#init is required.
Type
boolean

setBbox(bbox)

Specify the latitude and longitude range of the image to be obtained.
Parameters:
Name Type Description
bbox BboxObject A BboxObject that represents a latitude and longitude range.

setColorMap(colorMap)

Specifies the color map used when converting an image into a visual representation.
Parameters:
Name Type Description
colorMap ColorMapObject A ColorMapObject that represents a color map.

setSize(width, height)

Specify the size of the image to be acquired.
Parameters:
Name Type Description
width number Number of pixels in width
height number Number of pixels in height

Type Definitions

Image-onloading(src, progress)

This is a callback function executed during data retrieval in Image#init. It is executed each time data is read in units of tiles in a COG (Cloud Optimized GeoTIFF).
Parameters:
Name Type Description
src src Data URL of the image visualizing only the tiles that have finished loading
progress number Progress rate expressed as a value from 0 to 100%