Hide Table of Contents
esri/dijit/util
esri/layer/pixelFilters
esri/process
esri/workers
Class: WCSLayer

require(["esri/layers/WCSLayer"], function(WCSLayer) { /* code goes here */ });

Description

(Added at v3.18)
(Currently in beta) The WCSLayer works with OGC Web Coverage Services. It retrieves coverage (raster) data and renderers it on the client. It supports version 1.0.0, 1.1.x, and 2.0.1. For version 2.0.1, it supports servers that support GEOTIFF coverage and implements the following extensions: Scaling, Interpolation, Range Subsetting, CRS, and KVP/Get.

To avoid cross-origin issues when using WCSLayer, you may set up a proxy server, or enable CORS on your web server and push host (server.domain.com:port) to esriConfig.defaults.io.corsEnabledServers. ArcGIS Server (10.3.1+) image service based WCS has CORS enabled by default.

The layer makes GetCoverage requests in the map's spatial reference, this requires the server to support the map's spatial reference in the related CRS parameters. ArcGIS Server-based WCS services support any WKID-based spatial reference supported in the JS API.

Samples

Search for samples that use this class.

Constructors

NameSummary
new WCSLayer(url, options?)Creates a new WCSLayer.

Constants

NameDescription
INTERPOLATION_BILINEARResamples pixel by bilinear interpolation. Value = 1.
INTERPOLATION_CUBICCONVOLUTIONResamples pixel by cubic convolution. Value = 2.
INTERPOLATION_NEARESTNEIGHBORResamples pixel by nearest neighbor. Value = 0.

Properties

NameTypeSummary
bandIdsNumber[]Zero-based array of current band selections.
coverageDescriptionWCSCoverageDescriptionA reference to a WCSCoverageDescription object.
coverageIdStringThe coverage identifier, defaults to the first coverage.
extentExtentThe extent of the full coverage.
formatStringRaster format of the layer.
interpolationNumberCurrent interpolation method.
loadedBooleanWhen the layer is loaded, the value becomes "true", and layer properties can be accessed.
multidimensionalDefinitionDimensionalDefinition[]Multiple dimensional definitions are usually used to filter data.
opacityNumberOpacity or transparency of layer.
pixelFilterFunctionA function that takes a pixelData object as input and processes it.
pixelTypeStringThe pixel type of the image service.
projectedFullExtentExtentThe projected extent in the map's spatial reference.
suspendedBooleanWhen true, the layer is suspended.
timeInfoTimeInfoTemporal information for the layer, such as time extent.
urlStringURL to a WCS Server endpoint.
versionStringThe version of WCSLayer, can be:
  • 1.0.0
  • 1.1.0
  • 1.1.1
  • 1.1.2
  • 2.0.1
.
visibleBooleanThe visibility of the layer.
wcsConnectionWCSConnectionA WCS Connection object.

Methods

NameReturn typeSummary
getContext()ObjectReturns the context of the Canvas.
identify(mapPoint)PromiseReturns an array of graphics as a Promise.
resume()NoneResumes layer drawing.
setOpacity(opacity)NoneSets the opacity of the layer.
setPixelFilter(pixelFilter, doNotRefresh?)NoneSets a pixelFilter on the layer.
setUseMapTime(use)NoneDetermines if the layer will update its content based on the map's current time extent.
setVisibility(isVisible)NoneSets the visibility of the layer.
suspend()NoneSuspends layer drawing.

Events

[ On Style Events | Connect Style Event ]
All On Style event listeners receive a single event object. Additionally, the event object also contains a 'target' property whose value is the object which fired the event.

Events

NameEvent ObjectSummary
error
{
  error: <Error>
}
Fires when there is a problem retrieving a layer.
load
{
  layer: <Layer>
}
Fires after layer properties for the layer are successfully populated.
opacity-change
{
  opacity: <Number>
}
Fires when the layer opacity has been changed, and returns an object with the opacity value.
refresh-interval-changeThis event is fired when the layer's refreshInterval is modified.
resumeFires when a layer resumes drawing.
scale-range-changeFires when a layer's minScale and/or maxScale is changed.
scale-visibility-changeFires when a layer's scale visibility changes.
suspendFires when a layer suspends drawing.
update-end
{
  error: <Error>
}
Fires when a layer has finished updating its content.
update-startFires when a layer begins to update its content.
visibility-change
{
  visible: <Boolean>
}
Fires when the layer visibility has been changed, and returns an object with a Boolean visible property containing the new visibility value of the layer.
Constructor Details

new WCSLayer(url, options?)

Creates a new WCSLayer.
Parameters:
<String> url Required URL to a WCS Server endpoint. NOTE: It is also possible to pass optional parameters in the URL, e.g.
var wcsLayer = new WCSLayer {url: "https://sampleserver6.arcgisonline.com/arcgis/services/ScientificData/SeaTemperature/ImageServer/WCSServer?foo=bar"};
<Object> options Optional Optional parameters. See options list below.
options properties:
<String> coverageId Optional The coverage identifier, defaults to the first coverage.
<Boolean> drawMode Optional Sets the layer's draw mode. Set to false if using drawType: "webgl" since pixels are rendered by webgl shaders instead of this layer.
<String> drawType Optional Sets the context of the Canvas. Known values: "2d" | "webgl" | "experimental-webgl" | "webgl2" | "experimental-webgl2"
<Function> pixelFilter Optional A function that takes a pixelData object as input and processes it.
<String> version Optional The version of WCSLayer, can be:
  • 1.0.0
  • 1.1.0
  • 1.1.1
  • 1.1.2
  • 2.0.1
<WCSConnection> wcsConnection Optional A WCS Connection object. Set this if you already created a WCSConnection to avoid extra overhead.
Sample:
var wcsUrl = "//sampleserver6.arcgisonline.com/arcgis/services/ScientificData/MODIS_Landcover/ImageServer/WCSServer";  
var wcsLayer = new WCSLayer(wcsUrl, {
  version: "1.0.0",
  pixelFilter: colorizer }
);
Property Details

<Number[]> bandIds

Zero-based array of current band selections.

<WCSCoverageDescription> coverageDescription

<String> coverageId

The coverage identifier, defaults to the first coverage.

<Extent> extent

The extent of the full coverage.

<String> format

Raster format of the layer. Defaults to the "TIFF" format string based on the WCS server. This can be "JPG" or "PNG" if supported by the server.
Default value: TIFF

<Number> interpolation

Current interpolation method. The interpolation method affects how the raster dataset is transformed when it undergoes warping or when it changes coordinate space. See the constants table for a list of possible interpolation values.

<Boolean> loaded

When the layer is loaded, the value becomes "true", and layer properties can be accessed.
Known values: true | false

<DimensionalDefinition[]> multidimensionalDefinition

Multiple dimensional definitions are usually used to filter data.
Sample:
var wcs = new WCSLayer();
wcs.multidimensionalDefinition = [];
  wcs.multidimensionalDefinition.push(new DimensionalDefinition({
  variableName: "Salinity",
  dimensionName: "StdTime",
  values: [1259625600000]
}));

<Number> opacity

Opacity or transparency of layer. Values range from 0.0 to 1.0, where 0.0 is 100% transparent and 1.0 has no transparency.
Known values: 0.0 - 1.0
Default value: 1

<Function> pixelFilter

A function that takes a pixelData object as input and processes it. The pixelData object contains a pixelBlock property that gives you access to all of the pixels in the raster.

Inside the pixelFilter, you may loop through pixels through the pixelBlock property of the pixelData object and process them. See the RasterLayer sample for an example of how to apply a pixelFilter to a RasterLayer.

<String> pixelType

The pixel type of the image service. Pertains to the type of values stored in the raster, such as signed integer, unsigned integer, or floating point. Integers are whole numbers, whereas floating points have decimals.
Known values: C64 | C128 | F32 | F64 | S8 | S16 | S32 | U1 | U2 | U4 | U8 | U16 | U32 | UNKNOWN

<Extent> projectedFullExtent

The projected extent in the map's spatial reference. If the map is not in WGS84, Web Mercator, or the native spatial reference of the WCS Coverage, it will need to set.

<Boolean> suspended

When true, the layer is suspended. A layer is considered to be suspended when one of the following is true:
  • The layer is hidden.
  • The layer is not visible at the current map scale.
  • The layer is explicitly suspended by calling the Layer.suspend method.
Known values: true | false

<TimeInfo> timeInfo

Temporal information for the layer, such as time extent. If this property is null or not specified, then the layer does not support time-related operations.

<String> url

URL to a WCS Server endpoint. NOTE: It is also possible to pass optional parameters in the URL, e.g.
var wcsLayer = new WCSLayer {url: "https://sampleserver6.arcgisonline.com/arcgis/services/ScientificData/SeaTemperature/ImageServer/WCSServer?foo=bar"};

<String> version

The version of WCSLayer, can be:
  • 1.0.0
  • 1.1.0
  • 1.1.1
  • 1.1.2
  • 2.0.1

<Boolean> visible

The visibility of the layer.
Known values: true | false
Default value: true

<WCSConnection> wcsConnection

A WCS Connection object. Set this if you already created a WCSConnection to avoid extra overhead.
Method Details

getContext()

Returns the context of the Canvas. Known values are CanvasRenderingContext2D | WebGLRenderingContext | WebGL2RenderingContext
Return type: Object

identify(mapPoint)

Returns an array of graphics as a Promise. The returned graphic(s) uses the layer's full extent, and contain a special Raster.ServicePixelValue attribute that represents a pixel value at the map point's native resolution.
Return type: Promise
Parameters:
<Point> mapPoint Required The map point location in which to identify.

resume()

Resumes layer drawing.

setOpacity(opacity)

Sets the opacity of the layer.
Parameters:
<Number> opacity Required Value from 0 to 1, where 0 is 100% transparent and 1 has no transparency. The default value is 1.

setPixelFilter(pixelFilter, doNotRefresh?)

Sets a pixelFilter on the layer. A pixel filter is a function that takes a pixelData object as input and processes it. The pixelData object contains a pixelBlock property that gives you access to all of the pixels in the raster.

Inside the pixelFilter, you may loop through pixels through the pixelBlock property of the pixelData object and process them.

Parameters:
<Function> pixelFilter Required The function defining the PixelFilter to set on the layer. It sets the value of the pixelFilter property.
<Boolean> doNotRefresh Optional When true the layer will not refresh the map image. The default value is false.

setUseMapTime(use)

Determines if the layer will update its content based on the map's current time extent.
Parameters:
<Boolean> use Required Use true to update the layer's content based on the map's current time extent.

setVisibility(isVisible)

Sets the visibility of the layer.
Parameters:
<Boolean> isVisible Required Indicate whether to set layer visibility.

suspend()

Suspends layer drawing.
Event Details
[ On Style Events | Connect Style Event ]

error

Fires when there is a problem retrieving a layer.
Event Object Properties:
<Error> error ArcGIS Server error message returned in a JavaScript error object.

load

Fires after layer properties for the layer are successfully populated. This event must be successful before the layer can be added to the map.
Event Object Properties:
<Layer> layer The loaded layer.

opacity-change

Fires when the layer opacity has been changed, and returns an object with the opacity value.
Event Object Properties:
<Number> opacity Fires when the layer opacity (transparency) changes. A number property named opacity that indicates the new opacity. Values range from 0.0 to 1.0, where 0.0 is 100% transparent and 1.0 has no transparency.

refresh-interval-change

This event is fired when the layer's refreshInterval is modified.

resume

Fires when a layer resumes drawing.

scale-range-change

Fires when a layer's minScale and/or maxScale is changed.

scale-visibility-change

Fires when a layer's scale visibility changes. The scale visibility changes when a layer is initially visible and becomes invisible because the map scale does not intersect the layer's scale range or vice versa.

suspend

Fires when a layer suspends drawing

update-end

Fires when a layer has finished updating its content. It is the responsibility of the subclass to determine when this event is fired.
Event Object Properties:
<Error> error The error object is available when an error occurs during the update.

update-start

Fires when a layer begins to update its content. It is the responsibility of the subclass to determine when this event is fired.

visibility-change

Fires when the layer visibility has been changed, and returns an object with a Boolean visible property containing the new visibility value of the layer.
Event Object Properties:
<Boolean> visible A boolean property named visible indicates whether or not the layer is visible after visibility changed.