FlowRenderer

AMD: require(["esri/renderers/FlowRenderer"], (FlowRenderer) => { /* code goes here */ });
ESM: import FlowRenderer from "@arcgis/core/renderers/FlowRenderer";
Class: esri/renderers/FlowRenderer
Inheritance: FlowRenderer Accessor
Since: ArcGIS API for JavaScript 4.23

The FlowRenderer allows you to visualize your raster data with animated streamlines. This renderer can be used to visualize flow direction and magnitude information for meteorology and oceanography raster data.

To use this renderer, the source type of your raster dataset must be Vector-UV or Vector-MagDir. The direction of the raster defines the direction of movement, and the magnitude defines the visible length of the streamline.

flow renderer

Known Limitations

See also:
Example:
const renderer = new FlowRenderer({
  density: 1, // visualization will have the maximum amount of streamlines
  color: [50, 120, 240], // blue
  flowSpeed: 10,
  trailWidth: "2px"
});

Constructors

new FlowRenderer(properties)
Parameter:
properties Object
optional

See the properties for a list of all the properties that may be passed into the constructor.

Example:
let renderer = {
  type: "flow",
  color: [50, 120, 240, 1]
}

Property Overview

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
Show inherited properties Hide inherited properties
Name Type Summary Class
AuthoringInfomore details

Contains metadata about renderers generated from the flowRendererCreator.createRenderer() method, including information for setting UI elements such as sliders and themes.

more detailsFlowRenderer
Colormore details

The color of the animated streamlines.

more detailsFlowRenderer
Stringmore details

The name of the class.

more detailsAccessor
Numbermore details

The density of the streamlines.

more detailsFlowRenderer
Stringmore details

Defines the flow direction of the data.

more detailsFlowRenderer
Numbermore details

The speed of the animated streamlines, relative to the simulation time.

more detailsFlowRenderer
Objectmore details

An object providing options for displaying the renderer in the Legend.

more detailsFlowRenderer
Numbermore details

The maximum path length streamlines will travel in points.

more detailsFlowRenderer
Stringmore details

The front cap of the streamline.

more detailsFlowRenderer
Numbermore details

The approximate visible length of the streamline in points.

more detailsFlowRenderer
Numbermore details

The width of the streamline trail in points.

more detailsFlowRenderer
Stringmore details

The type of Renderer.

more detailsFlowRenderer
VisualVariable[]more details

An array of VisualVariable objects.

more detailsFlowRenderer

Property Details

authoringInfo AuthoringInfoautocast

Contains metadata about renderers generated from the flowRendererCreator.createRenderer() method, including information for setting UI elements such as sliders and themes. This allows the authoring clients to save specific overridable settings so user selections can be remembered the next time they are accessed via the UI.

color Color

The color of the animated streamlines.

Default Value:[255, 255, 255, 1]
declaredClass Stringreadonly inherited

The name of the class. The declared class name is formatted as esri.folder.className.

density Number

The density of the streamlines. This will determine how many lines appear in the visualization. Accepted values are between 0 and 1. A value of 0 means no lines will be rendered. A value of 1 will render the maximum number of lines.

density = 0.1 density = 0.5 density = 1
density 0.1 density 0.5 density 1
Default Value:0.8
flowRepresentation String

Defines the flow direction of the data. This can be modified to display meteorological (the direction it is flowing from) or climatological data (the direction it is flowing to).

Value Description Example
flow-from Flow from angle. flow-from
flow-to Flow to angle. flow-to

Possible Values:"flow-from"|"flow-to"

Default Value:"flow-from"
flowSpeed Number

The speed of the animated streamlines, relative to the simulation time. This serves as a multiple of the magnitude from the raster layer. For instance, if the magnitude is 2ms, and the flowSpeed is 10, then the actual speed of the streamline will be 20 pts/s. A speed of 0 will result in no animation.

Default Value:10
legendOptions Object

An object providing options for displaying the renderer in the Legend.

Property:
title String
optional

Describes the variable driving the visualization. This is displayed as the title of the corresponding renderer in the Legend.

Example:
renderer.legendOptions = {
  title: "Wind speed"
};
maxPathLength Numberautocast
Autocasts from Number|String

The maximum path length streamlines will travel in points. Only a portion of the streamline will be visible at a time depending on the magnitude or UV coming from the raster layer and the defined trailLength. During the course of the animation, the visible streamline will travel to reach the path length defined here, then will restart. This value may be autocast with a string expressing size in points or pixels (e.g. 100px).

Default Value:200
Examples:
// width in points
flowRenderer.maxPathLength = 100;
// width in pixels
flowRenderer.maxPathLength = "200px";
// width in points
flowRenderer.maxPathLength = "100pt";
trailCap String
Since: ArcGIS API for JavaScript 4.24

The front cap of the streamline. A round cap will only be applied if trailWidth is greater than 4px or 3pt.

Possible Values:"butt"|"round"

Default Value:"butt"
trailLength Number

The approximate visible length of the streamline in points. The streamlines will appear shorter when the trailLength is a smaller number, since they will start to fade before they reach the full maxPathLength.

trailLength = 20 trailLength = 100 trailLength = 250
trailLength 20 trailLength 100 trailLength 250
Default Value:100
trailWidth Numberautocast
Autocasts from Number|String

The width of the streamline trail in points. This value may be autocast with a string expressing size in points or pixels (e.g. 3px).

Default Value:1.5
Examples:
// width in points
flowRenderer.trailWidth = 4;
// width in pixels
flowRenderer.trailWidth = "2px";
// width in points
flowRenderer.trailWidth = "4pt";
type Stringreadonly

The type of Renderer.

For FlowRenderer the type is always "flow".

visualVariables VisualVariable[]autocast
Autocasts from Object[]

An array of VisualVariable objects. Each object must indicate the type of visual variable to apply (e.g. ColorVisualVariable), the numeric field from which to drive the visualization, and the visual values to map to the data. The following list identifies each visual variable type that is supported with the FlowRenderer and provides a link to the specification table of each: ColorVisualVariable, OpacityVisualVariable, and SizeVisualVariable. SizeVisualVariable will update the trailWidth property.

When setting fields for the visual variables set on the FlowRenderer, use the Magnitude field. Magnitude will return pixel values from the first band. If the data represents u (zonal) and v (meridional) speed components, values are automatically converted to Magnitude and Direction.

See also:
Example:
const renderer = new FlowRenderer({
   visualVariables: [{
      type: "color",
      field: "Magnitude",
      stops: [
        { value: 3, color: "#0080FF" },
        { value: 15, color: "#00FF00" }
      ]
    }, {
      type: "opacity",
      field: "Magnitude",
      stops: [
        { value: 1, opacity: 0.5 },
        { value: 8, opacity: 1 }
      ]
   }]
});

Method Overview

Show inherited methods Hide inherited methods
Name Return Type Summary Class
FlowRenderermore details

Creates a deep clone of the renderer.

more detailsFlowRenderer
*more details

Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product.

more detailsFlowRenderer
more details

Adds one or more handles which are to be tied to the lifecycle of the object.

more detailsAccessor
Objectmore details

Converts an instance of this class to its ArcGIS portal JSON representation.

more detailsFlowRenderer

Method Details

clone(){FlowRenderer}

Creates a deep clone of the renderer.

Returns:
Type Description
FlowRenderer
Example:
// Creates a deep clone of the first layer's renderer
let renderer = view.map.layers.getItemAt(0).renderer.clone();
fromJSON(json){*}static

Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product. The object passed into the input json parameter often comes from a response to a query operation in the REST API or a toJSON() method from another ArcGIS product. See the Using fromJSON() topic in the Guide for details and examples of when and how to use this function.

Parameter:
json Object

A JSON representation of the instance in the ArcGIS format. See the ArcGIS REST API documentation for examples of the structure of various input JSON objects.

Returns:
Type Description
* Returns a new instance of this class.
own(handleOrHandles)inherited
Since: ArcGIS API for JavaScript 4.24

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.whenOnce(() => !view.updating)
  .then(() => {
    wkidSelect.disabled = false;
});

handle.remove();

// Assign a handle using own()
this.own(reactiveUtils.whenOnce(() => !view.updating)
  .then(() => {
    wkidSelect.disabled = false;
  }));
Parameter:
handleOrHandles WatchHandle|WatchHandle[]

Handles marked for removal once the object is destroyed.

toJSON(){Object}

Converts an instance of this class to its ArcGIS portal JSON representation. See the Using fromJSON() guide topic for more information.

Returns:
Type Description
Object The ArcGIS portal JSON representation of an instance of this class.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.