The ParameterizedLinePainter allows you to visualize line datasets with dynamic styling and filtering, as well as per-pixel styling. This painter uses the graphics hardware to efficiently switch styling and filtering.

It is very similar to the TrajectoryPainter described in Visualizing trajectory lines, but more versatile:

  • Property filtering: efficiently filter on feature properties.

  • Property styling: efficiently choose and switch colors based on feature properties.

  • Range filtering: filter parts of a line based on a range.

  • Per-pixel coloring: per-pixel color along a line based on a varying property with a range color map.

  • Density: this painter can be combined with regular density painting.

Figure 1. Lines with varying color based on aircraft climb rate.

At runtime, you can efficiently change:

  • Styling expressions: instead of overriding paintBody, you must configure a set of expressions that apply to all features, based on their properties. These expressions are automatically evaluated for each feature. You can use this to color lines based on properties, for example.

  • A range window: you can configure a range window, as well as a function to provide a range value for each point along your lines. Only the parts of your lines that correspond to the range window are painted. You can use this to only show parts of a line with high fuel consumption, for example.

  • Density: you can enable density using FeaturePainter.density. See Density painting on a WebGLMap for more information.

Refer to the API documentation of ParameterizedLinePainter for more details and examples, and see the Parameterized Lines sample for an example.