VectorFieldRenderer

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

The VectorFieldRenderer allows you to display your raster data with vector symbols. This renderer is often used for visualizing flow direction and magnitude information in meteorology and oceanography raster data. It can also be used to symbolize a single raster layer where the symbols are scalar. The direction of the raster defines the angles, while the magnitude of the raster defines the size of the symbol.

elevation-info

Known Limitations

See also
Example
const renderer = new VectorFieldRenderer({
  style: "beaufort-kn", // Beaufort point symbol (knots)
  flowRepresentation: "flow-from", // show flow to angle for wind direction
  symbolTileSize: 10, // draw one symbol in every 10x10 pixels
   visualVariables: [
     {
       type: "size",
       field: "Magnitude", // values read from the first band
       maxDataValue: 32,
       maxSize: "100px",
       minDataValue: 0.04,
       minSize: "8px"
     },
     {
       type: "rotation",
       field: "Direction", // values read from the second band
       rotationType: "geographic"
     }
   ]
});

Constructors

new VectorFieldRenderer(properties)
Parameter
properties Object
optional

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

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
String

Attribute field presenting the magnitude.

more details
VectorFieldRenderer
String

The name of the class.

more details
Accessor
String

Defines the flow direction of the data.

more details
VectorFieldRenderer
String

Predefined symbol styles used to represent the vector flow.

more details
VectorFieldRenderer
Number

Determines the density of the symbols.

more details
VectorFieldRenderer
String

The type of Renderer.

more details
VectorFieldRenderer
VisualVariable[]

An array of VisualVariable objects.

more details
VectorFieldRenderer

Property Details

attributeField String

Attribute field presenting the magnitude.

For VectorFieldRenderer the attributeField is always "Magnitude".

declaredClass Stringreadonly inherited

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

flowRepresentation String

Defines the flow direction of the data. If you have a data showing wind direction, it is recommended to use flow-to to show the natural flow direction of the wind on the map.

Value Description
flow-from VectorFieldRenderer symbol style point towards the direction of the data.
flow-to VectorFieldRenderer symbol style point to the opposite direction of the data.

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

Default Value:"flow-from"
style String

Predefined symbol styles used to represent the vector flow.

Value Description
beaufort-ft Beaufort point symbol (feet)
beaufort-km Beaufort point symbol (kilometers)
beaufort-kn Beaufort point symbol (knots)
beaufort-m Beaufort point symbol (meters)
beaufort-mi Beaufort point symbol (miles)
classified-arrow Classified arrow point symbol
ocean-current-kn Ocean current point symbol (knots)
ocean-current-m Ocean current point symbol (meters)
simple-scalar Simple scalar point symbol
single-arrow Single arrow point symbol
wind-barb Barb wind speed point symbol

Possible Values:"beaufort-ft"|"beaufort-km"|"beaufort-kn"|"beaufort-m"|"beaufort-mi"|"classified-arrow"|"ocean-current-kn"|"ocean-current-m"|"simple-scalar"|"single-arrow"|"wind-barb"

Default Value:"single-arrow"
symbolTileSize Number

Determines the density of the symbols. Larger tile size, fewer symbols. The VectorFieldRenderer draws one symbol within a defined tile size (in screen pixels).

Default Value:50
type Stringreadonly

The type of Renderer.

For VectorFieldRenderer the type is always "vector-field".

visualVariables VisualVariable[]autocast
Autocasts from Object[]

An array of VisualVariable objects. Each object must indicate the type of visual variable to apply (e.g. SizeVisualVariable, RotationVisualVariable), the numeric field or expression from which to drive the visualization, and the visual values to map to the data.

When setting fields for the visual variables set on the VectorFieldRenderer, use Magnitude and Direction fields. Magnitude will return pixel values from the first band. Direction will return values from the second 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 VectorFieldRenderer({
  style: "beaufort-kn", // Beaufort point symbol (knots)
  flowRepresentation: "flow-from", // show flow to angle for wind direction
  symbolTileSize: 10, // controls the density of the displayed vector symbols.
   visualVariables: [
     {
       type: "size",
       field: "Magnitude", // values read from the first band
       maxDataValue: 32,
       maxSize: "100px",
       minDataValue: 0.04,
       minSize: "8px"
     },
     {
       type: "rotation",
       field: "Direction", // values read from the second band
       rotationType: "geographic"
     }
   ]
});

Method Overview

Show inherited methods Hide inherited methods
Name Return Type Summary Class

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

more details
Accessor
VectorFieldRenderer

Creates a deep clone of the renderer.

more details
VectorFieldRenderer
*

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

more details
VectorFieldRenderer
Boolean

Returns true if a named group of handles exist.

more details
Accessor

Removes a group of handles owned by the object.

more details
Accessor
Object

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

more details
VectorFieldRenderer

Method Details

addHandles(handleOrHandles, groupKey)inherited
Since: ArcGIS API for JavaScript 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 }
);

// Handle gets removed when the object is destroyed.
this.addHandles(handle);
Parameters
handleOrHandles WatchHandle|WatchHandle[]

Handles marked for removal once the object is destroyed.

groupKey *
optional

Key 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.

Creates a deep clone of the renderer.

Returns
Type Description
VectorFieldRenderer A deep clone of the object that invoked this method.
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.
hasHandles(groupKey){Boolean}inherited
Since: ArcGIS API for JavaScript 4.25

Returns true if a named group of handles exist.

Parameter
groupKey *
optional

A group key.

Returns
Type Description
Boolean Returns true 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");
}
removeHandles(groupKey)inherited
Since: ArcGIS API for JavaScript 4.25

Removes a group of handles owned by the object.

Parameter
groupKey *
optional

A 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");
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.