Animated flow

A map can show which way things move. Turn on Animate flow for a line layer and bright comets travel along every line, on top of the line's own style. Upload a wind or current raster with east and north components and the same setting runs thousands of particles through it, on the flat map and on the globe.

The motion is drawn over the layer you already styled. Its colours, its legend, its popups, search and printing all keep working the way they did, because the layer itself has not changed.

Lines that flow

Rivers, pipelines, shipping lanes, flight routes and migration tracks all work. Comets move along each line in the order its points were drawn, so a river traced from source to mouth flows downstream. If yours runs the wrong way, tick Reverse direction.

To turn it on, open the map in the builder, expand the line layer and open Animate flow:

  1. Tick Animate flow. The preview starts moving straight away, with settings that look right on most maps.
  2. Under Speed, choose Same everywhere, or take the speed from a number property of each line, or from a property that holds one number per point of the line. The slowest and fastest values fill in from the layer's statistics.
  3. Set Speed on screen, Spacing and Trail in screen pixels. They stay the same at every zoom: zooming in adds comets between the ones you see instead of spreading them apart. The trail can be at most 40% of the spacing, so neighbouring comets never touch.
  4. Keep Follow line colours for comets in each line's own colour, or pick one colour. White comets over coloured lines is a classic look. Glow adds them together, which reads best on dark basemaps.
  5. Dim lines while animating sets how far the lines fade back while comets run. The lines return to full strength wherever the animation is not shown.

Comets in faster parts of a line move faster and further apart, the way water does. A speed per point needs exactly one value for every point of the line (every part of a multi-line, in order). When you save, Sarkoa keeps that array out of the map tiles, since only the comets read it, and rebuilds the tiles once if it needs to.

Wind and currents

A raster whose bands are the east and north components of a flow (wind at 10 m, ocean currents, a river model's velocity) can run particles. Upload it as usual:

  • A GeoTIFF with two bands, east then north. Bands named like u10 and v10, uo and vo, UGRD and VGRD, water_u and water_v or eastward_wind and northward_wind are recognised on their own.
  • A NetCDF file, naming the east and north variables, in that order, as variable_names: ["u10", "v10"]. They are stacked into one raster. A model's own names work too.
  • A GRIB file from a weather model. A file holding just UGRD and VGRD at one level becomes a wind layer with nothing to set, and HRRR or NAM wind on its Lambert grid is turned to true north because the file says it follows the grid. See Weather and climate files.
  • Speed and direction bands work too, when you say which is which and whether the direction is where the wind comes from or where the water goes to.

East and north usually mean true east and north. A weather or ocean model's own output can instead point its components along its grid: HRRR and NAM on their Lambert grid, a regional model on a rotated pole. There the grid's "up" can be 20° or more from true north, and names like UGRD or u10 do not say which kind you have. Sarkoa keeps such a file as an ordinary raster until you tell it, with relative_to: "grid" (a model's native output, usually) or "earth". It then turns grid components to true north at every pixel before it draws them. On a lon/lat grid the question does not arise.

Sarkoa stores the field as three bands: east, north and speed. Colour the speed band with a continuous style as you would any measurement raster, then open Animate flow on the layer in the builder. Particles per 100 x 100 px sets how many there are, and the reference speed (the field's median by default) sets which speed moves at the chosen screen speed. Particles can take one colour or follow the layer's colour ramp by speed.

A wind series plays with the time slider. Between two hourly frames the particles follow a blend of both, so the wind changes smoothly as the slider moves instead of jumping each hour. Click a point to read its value as speed and direction, such as "12.3 m/s from 250°" for wind or "0.42 m/s toward 080°" for a current.

What viewers see

Hosted maps, embeds and the in-app viewer start moving on load. A Pause animation button appears in the map controls whenever something on the map moves by itself. It is a toggle you can reach with the keyboard.

Visitors who ask their system for reduced motion see the comets and trails held still. The bright heads and fading tails still show which way things go, and the button plays the animation for that visit if they want it. The animation also stops while the map is scrolled out of view or the tab is in the background.

Printed maps show the lines and rasters as styled, without motion, and the legend gains one row, "Direction of flow" or "Direction and relative speed of flow", on screen only.

From the API and AI agents

Animation is the flow block of a layer in the map document, beside vectorStyle or rasterStyle:

"flow": {
  "speed": { "mode": "attribute", "attribute": "relative_speed", "domain": [0, 100], "transform": "sqrt", "range": [0.35, 2.5] },
  "speedPx": 28,
  "spacingPx": 160,
  "trailPx": 46,
  "width": 2.2,
  "color": "style",
  "glow": true,
  "baseOpacity": 0.35
}

A wind raster takes density, refSpeed, speedPx, trailPx, width, color, opacity and glow instead. Keys you leave out take their defaults, and null removes the block. A layer cannot have both flow and a visualization: a visualization replaces the line, and flow draws on top of it. With the MCP, update_map sets it with an updateLayer patch, and upload_complete takes tile_exclude_properties, variable_names and vector_field for the uploads above.

Limits

  • Comets work for lines in any vector format, up to two million points in one layer (fewer on phones with little memory). Above that the lines still draw, without comets, and the viewer says why. Older uploads that have no column copy yet read the original GeoJSON instead, up to 32 MiB (see Visualizations).
  • In 3D terrain view, comets and particles run on the ground, and a hill in front hides what is behind it. Comets on lines and particles in a wind or current raster also draw on the globe at any zoom.
  • Time-based line layers cannot animate flow yet.
  • A GeoTIFF is read as a wind or current field on its own only when it has exactly the two bands. A file with more (temperature and pressure beside the wind) stays an ordinary raster unless you say which bands are east and north.
  • A model's native output often gives every cell its own latitude and longitude (ROMS, WRF and regional NEMO files do). Those work, as long as the east and north components sit at the same points. Some models put them on different points of the grid: ROMS's u and v and WRF's U and V are like that. Use the pair the model writes at the cell centres instead, such as u_eastward and v_northward from ROMS or U10 and V10 from WRF.
  • A grid that wraps the whole world with its own latitude and longitude per cell, such as NEMO's ORCA grid, cannot run particles yet. Regrid it to a regular grid first.
  • The motion shows direction and relative speed. For a line layer, only say a speed in real units if your data has one. The comets on a model's streamlines are not a measured current.