AMD:
require(["esri/rasterRenderers"], (rasterRenderers) => { /* code goes here */ });
ESM:
import * as rasterRenderers from "@arcgis/core/rasterRenderers.js";
Object:
esri/rasterRenderers
Since: ArcGIS Maps SDK for JavaScript 4.13
A convenience module for importing renderer classes that can be used to render ImageryLayer when developing with TypeScript. For example, rather than importing renderers one at a time like this:
import FlowRenderer from "esri/renderers/FlowRenderer";
import ClassBreaksRenderer from "esri/renderers/ClassBreaksRenderer";
import UniqueValueRenderer from "esri/renderers/UniqueValueRenderer";
import RasterStretchRenderer from "esri/renderers/RasterStretchRenderer";
import RasterColormapRenderer from "esri/renderers/RasterColormapRenderer";
import RasterShadedReliefRenderer from "esri/renderers/RasterShadedReliefRenderer";
import VectorFieldRenderer from "esri/renderers/VectorFieldRenderer";
You can use this module to import them on a single line:
import { FlowRenderer, ClassBreaksRenderer, UniqueValueRenderer, RasterColormapRenderer, RasterStretchRenderer, RasterShadedReliefRenderer, VectorFieldRenderer } from "esri/rasterRenderers";
This module also allows you to implement type guards on renderers, making your code smarter.
import { Renderer } from "esri/rasterRenderers";
function logRenderer(renderer: RasterStretchRenderer): void {
if (renderer.type == "raster-stretch") {
// the compiler knows the renderer must be a RasterStretchRenderer
console.log("renderer color ramp: ", renderer.colorRamp);
}
}
Type Definitions
-
ClassBreaksRenderer
ClassBreaksRenderer ClassBreaksRenderer
-
ClassBreaksRenderer.
-
FlowRenderer
FlowRenderer FlowRenderer
-
FlowRenderer.
-
RasterColormapRenderer
RasterColormapRenderer RasterColormapRenderer
-
RasterColormapRenderer.
-
RasterShadedReliefRenderer
RasterShadedReliefRenderer RasterShadedReliefRenderer
-
RasterShadedReliefRenderer.
-
RasterStretchRenderer
RasterStretchRenderer RasterStretchRenderer
-
RasterStretchRenderer.
-
UniqueValueRenderer
UniqueValueRenderer UniqueValueRenderer
-
UniqueValueRenderer.
-
VectorFieldRenderer
VectorFieldRenderer VectorFieldRenderer
-
VectorFieldRenderer.