ESM: import PixelBlock from "@arcgis/core/layers/support/PixelBlock.js";
CDN: const PixelBlock = await $arcgis.import("@arcgis/core/layers/support/PixelBlock.js");
Class: @arcgis/core/layers/support/PixelBlock
Since: ArcGIS Maps SDK for JavaScript 4.0
An object representing the pixel arrays in the view. It stores and decodes source data fetched from an image service associated with an ImageryLayer. This provides the user access to each pixel on the client via the pixels property. The PixelBlock object is designed to handle generic pixel arrays from any raster data source.
Constructors new PixelBlock(properties)
Parameter
optionalSee the properties for a list of all the properties that may be passed into the constructor.
Show inherited properties Hide inherited properties
Property DetailsInherited
Property declaredClass Stringreadonly
Since: ArcGIS Maps SDK for JavaScript 4.7 Accessor since 4.0, declaredClass added at 4.7.
The name of the class. The declared class name is formatted as esri.folder.className
.
The height (or number of rows) of the PixelBlock in pixels.
An array of nodata mask. All pixels are valid when mask is null.
maskIsAlpha Boolean
Indicates whether mask should be used as alpha values. If no (default), a pixel is valid when corresponding mask value is truthy
pixelType String
The pixel type.
Possible Values:"unknown" |"s8" |"s16" |"s32" |"u1" |"u2" |"u4" |"u8" |"u16" |"u32" |"f32" |"f64" |"c64" |"c128"
A two dimensional array representing the pixels from the Image Service displayed on the client. The length of the first dimension is the same as the number of bands in the layer. The length of the second dimension is height * width. The length of each band is the same. The pixels in each band are arranged row by row in this format: [p_00, p_10, p_20, ... p_10, p_11, ...]
where p_xy
is the pixel value at the column x
and row y
.
Example
let pixels = imgLyr.pixelData.pixelBlock.pixels;
// Prints the number of bands in the layer
console.log(pixels.length);
// An array containing all the pixels in the first band
let band1 = pixels[0];
An array of objects containing numeric statistical properties. Each object has the following specification if defined.
The width (or number of columns) of the PixelBlock in pixels.
Show inherited methods Hide inherited methods
Method Details addData(planeData)
Adds another plane to the PixelBlock.
Parameters
Specification
The data to add to the PixelBlock.
Parameters
Specification
An array representing the pixel data to add.
optionalAn object containing numeric statistical properties.
Specification
The minimum pixel value in the pixels array.
The maximum pixel value in the pixels array.
Value representing areas of no data.
Inherited
Method addHandles(handleOrHandles, groupKey)
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, addHandles added at 4.25.
Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.
// Manually manage handles
const handle = reactiveUtils.when(
() => !view.updating,
() => {
wkidSelect.disabled = false;
},
{ once: true }
);
this.addHandles(handle);
// Destroy the object
this.destroy();
Parameters
Handles marked for removal once the object is destroyed.
groupKey *
optionalKey identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.
Returns pixels and masks using a single array in bip format (e.g. [p_00_r, p_00_g, p_00_b, p_00_a, p_10_r, p_10_g, p_10_b, p_10_a, .....]). Use this method to get an unsigned 8 bit pixel array. The result can be used to create a webgl texture.
Returns
Similar to getAsRGBA, but returns floating point data. The result can be used to create a webgl texture (OES_texture_float).
Returns
Returns the plane band count of the PixelBlock.
Returns
Inherited
Method hasHandles(groupKey){Boolean}
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, hasHandles added at 4.25.
Returns true if a named group of handles exist.
Parameter
groupKey *
optionalA group key.
Returns
Type Description Boolean Returnstrue
if a named group of handles exist.
Example
// Remove a named group of handles if they exist.
if (obj.hasHandles("watch-view-updates")) {
obj.removeHandles("watch-view-updates");
}
Inherited
Method removeHandles(groupKey)
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, removeHandles added at 4.25.
Removes a group of handles owned by the object.
Parameter
groupKey *
optionalA group key or an array or collection of group keys to remove.
Example
obj.removeHandles(); // removes handles from default group
obj.removeHandles("handle-group");
obj.removeHandles("other-handle-group");
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4