Global

Methods

(async) getImage(params) → {Image}

This method allows you to easily obtain an Image instance under the conditions specified by the parameters.
Parameters:
Name Type Description
params Object Conditions for obtaining an Image instance
Properties
Name Type Attributes Default Description
collection string URL of the dataset's collection.json
band string <optional>
The band names of the datasets defined in collection.json. If omitted, the first band defined within the dataset will be set automatically.
date Date <optional>
new Date() The Image instance is acquired according to this date and time. If no data exists at the specified date and time, the instance is automatically replaced with the date and time when the next available data exists. If the date and time are omitted, the current time is used, and the most recent data in the dataset is obtained.
bbox BboxObject <optional>
[-180,-90,180,90] BboxObject representing a latitude and longitude range
width number <optional>
1000 Specify the width. The unit is pixels.
height number <optional>
500 Specify the height. The unit is pixels.
colorMap ColorMapObject <optional>
This is the color map used for visualization. If omitted, the range from minimum to maximum values will be visualized in black to white.
bilinearResampling boolean <optional>
false If true, high-precision bilinear resampling is used. It is necessary when performing calculations such as differentiation to find slopes from the acquired terrain data. If false, a fast nearest neighbor method is used.
onloading getImage-onloading <optional>
function(){} This is a callback function that is executed while data is being retrieved. It is executed every time data is loaded on a per-tile basis from a COG file.
See:
Returns:
Returns an Image instance.
Type
Image
Example
import * as je from "./jaxa.earth.esm.js";
const image = await je.getImage({
	collection: "https://s3.ap-northeast-1.wasabisys.com/je-pds/cog/v1/JAXA.EORC_ALOS.PRISM_AW3D30.v3.2_global/collection.json",
	band: "DSM",
	bbox: [-180,-90,180,90],
	width: 1000,
	height: 500,
	colorMap: {
		min: 0,
		max: 6000,
		colors: "jet"
	}
});
document.body.appendChild(image.getCanvas());

(async) getTimeSeriesImage(params) → {Array.<Image>}

Retrieves all Image instances with dates within the range params.start <= date < params.end, based on the conditions specified in the parameters. We use Promise's parallel processing (Promise.all()) to quickly retrieve multiple data.
Parameters:
Name Type Description
params Object Conditions for obtaining an Image instance
Properties
Name Type Attributes Default Description
collection string URL of the collection.json in the dataset
band string <optional>
The band names of the dataset defined in collection.json. If this field is omitted, the first band in the dataset will be automatically set.
start Date Image instances after this date and time will be retrieved.
end Date Image instances earlier than this date and time (this date and time not included) will be retrieved.
bbox BboxObject <optional>
[-180,-90,180,90] This is a BboxObject that represents a latitude and longitude range.
width number <optional>
200 Specify the width. The unit is pixels.
height number <optional>
200 Specify the height. The unit is pixels.
colorMap ColorMapObject <optional>
This is the color map used for visualization. If omitted, the range from minimum to maximum values will be visualized in black to white (Please note that if omitted, each image will have a different color map.).
bilinearResampling boolean <optional>
false If true, high-precision bilinear resampling is used. It is necessary when performing calculations such as differentiation to find slopes from the acquired terrain data. If false, a fast nearest neighbor method is used.
onloading getTimeSeriesImage-onloading <optional>
function(){} This is a callback function that is executed while data is being retrieved. It is executed every time data is read in units of time.
See:
Returns:
Returns an array of Image instances in chronological order.
Type
Array.<Image>

Type Definitions

BboxObject

This is a numerical array representing the latitude and longitude range used for settings such as Image#setBbox. For numerical arrays in the case of geographic latitude and longitude (EPSG:4326), the latitude [deg] and longitude [deg] in WGS84 are used, and they are specified in a counterclockwise order as [western longitude, southern latitude, eastern longitude, northern latitude].

In the case of Arctic (EPSG:3995), the North Pole is set as the origin, with the +Y direction along the 180-degree longitude line, and the -Y direction along the 0-degree longitude line. Distance [m] is specified in meters counterclockwise as [-X, -Y, X, Y].

In the case of Antarctica (EPSG:3031), the South Pole is set as the origin, with the +Y direction along the 0-degree longitude line, and the -Y direction along the 180-degree longitude line. Distance [m] is specified in meters counterclockwise as [-X, -Y, X, Y].
Type:
  • Array.<number>
Example
//When specifying the entire globe
const bbox = [-180, -90, 180, 90];

//When specifying the area around Japan
const bbox = [120, 15, 160, 55];

//When specifying a radius of dl [deg] from a specific latitude and longitude point
const lng = 138.73;
const lat = 35.36;
const dl = 0.2;
const bbox = [lng - dl, lat - dl, lng + dl, lat + dl];

//Arctic (EPSG:3995) or Antarctic (EPSG:3031)
const bbox = [-8388608, -8388608, 8388608, 8388608];

ColorMapObject

These are the configuration conditions for the color map used for data visualization, which are set through Image#setColorMap or getImage, etc.
Type:
  • Object
Properties:
Name Type Attributes Default Description
min number Minimum value of the area to be painted
max number Maximum value of the area to be painted
colors string | Array.<string> <optional>
"gray" This is the name of a predefined colormap. You can use "gray" (black to white), "jet" (blue to light blue to green to yellow to red), "ndvi" (brown to green), "smc" (red to white to blue), and "ic" (navy to white). Alternatively, you can specify an array of color codes that indicate the colors of the colormap (e.g., ["ff0000","00ff00","0000ff"]).
deleteMin boolean <optional>
false If true, values below the minimum are made transparent. If unspecified or false, values below the minimum are also colored with the minimum value color.
deleteMax boolean <optional>
false If true, values above the maximum are made transparent. If unspecified or false, values above the maximum are also colored with the maximum value color.
log10 boolean <optional>
false If true, use a logarithmic scale. When using a logarithmic scale, be careful not to set min=0. If unspecified or false, use an equidistant scale.
nanColor string <optional>
"00000000" Specify the color code for the color to be applied to NaN. Enter it in the format "RRGGBB" or "RRGGBBAA". If not specified, the NaN pixels will be transparent "00000000".
See:
Example
//Fill values from 0 to 6000 with a rainbow gradient from blue to cyan to green to yellow to red. Fill missing data (NaN) with semi-transparent red.
const colorMap = {
	min: 0,
	max: 6000,
	colors: "jet",
	nanColor: "ff0000cc"
};

//Fill with black to white on a logarithmic scale from 0.1 to 100. However, make values below 0.1 transparent.
const colorMap = {
	min: 0.1,
	max: 100,
	colors: "gray",
	deleteMin: true,
	log10: false
};

DataObject

This is an object that stores data obtained by methods such as Image#getData in a way that is easy to handle. It also includes properties for internal processing other than those listed below.
Type:
  • Object
Properties:
Name Type Attributes Description
width number Image width (pixels)
height number Image height (pixels)
data Float32Array This is a one-dimensional array (Float32Array) that stores the values of each pixel sequentially from the top left to the top right, and from top to bottom in the image. The number of elements in the array is width * height. The data of the pixel (i, j) is stored at the (i + j * width)-th position in the one-dimensional array. Pixels that are outside the observation range or have no value contain NaN.
bbox BboxObject BboxObject representing the range of latitude and longitude
unit string <optional>
Unit of values stored in Float32Array
min number <optional>
The value of the pixel with the smallest value among all acquired pixels
max number <optional>
The value of the pixel with the largest value among all acquired pixels
validPixels number <optional>
The number of pixels that are not NaN among the values stored in the Float32Array for width * height
See:

getImage-onloading(src, progress)

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

getTimeSeriesImage-onloading(image, progress)

In getTimeSeriesImage, this is a callback function that is executed while data is being acquired. It is executed each time data is loaded for each Image instance.
Parameters:
Name Type Description
image Image Image instance with loading completed
progress number Progress rate represented as a value from 0 to 100%