The map-borders component in the LuciadRIA Toolbox now provides the map border functionality previously offered by the LuciadRIA border API. This page explains how to migrate from the old, built-in border API to the new Map Borders toolbox component.

The Vertical View and Timeline samples demonstrate how to use the map-borders component to render a cartesian map with border maps, including how to configure axes and add custom drawings on border maps.

The article How to draw a map with borders offers a full explanation of how to work with bordered maps.

Creating a map with borders

API discontinued since LuciadRIA 2026.0

The LuciadRIA API allowed configuring map borders (in pixels) and axes (for X and Y) directly in the RIAMap constructor. RIAMap used border (pixel insets) and axes (styling for X/Y) in the constructor:

new RIAMap(node, {
  reference: VERTICAL_VIEW_REFERENCE,
  border: { left: 120, bottom: 52 },
  axes: {
    xAxis // rendered on bottom
    yAxis // rendered on left
  },
});

New approach

Use the map-borders toolbox component to compose a main cartesian map with per-side border maps through BorderedMap:

import {BorderedMap} from "@luciad/ria-toolbox-map-borders/BorderedMap.js";

This code creates the vertical view with a cartesian main map and left and right border maps:

const borderedMap = new BorderedMap(container, {
  reference: VERTICAL_VIEW_REFERENCE
}, {
  left: {size: 120, axisConfiguration: leftAxis},
  bottom: {size: 56, axisConfiguration: bottomAxis}
  // top/right can be added the same way
});
vertical view with border maps
Figure 1. The vertical view with the cartesian main map and left and right border maps.

Migration

  • Replace RIAMap(…​ { border, axes, …​ }) with new BorderedMap(domNode, mapOptions, options).

  • Move map-related options, such as reference, controllers, and autoAdjustDisplayScale, into mapOptions.

  • Convert border.left and border.bottom to options.left.size and options.bottom.size (pixels). Add options.top and options.right if needed. All four sides are supported.

  • Convert axes.xAxis to options.bottom.axisConfiguration and axes.yAxis to options.left.axisConfiguration. Use options.top.axisConfiguration and options.right.axisConfiguration for additional sides.

AxisConfiguration

Previously, axis configuration was part of the LuciadRIA API. It’s now provided by the LuciadRIA Toolbox.

import {AxisConfiguration} from "@luciad/ria-toolbox-map-borders/axis/AxisConfiguration.js";

Compatibility

The interface is the same as before, with one addition:

  • gridLineStyle?: LineStyle: to set the line style of the grid lines.

Migration

  • Re-use your existing axis configurations. Add gridLineStyle if you want to customize the grids.

  • The old xAxis maps to the bottom (or top) border axisConfiguration.

  • The old yAxis maps to the left (or right) border axisConfiguration.

Painting on borders

API discontinued since LuciadRIA 2026.0

Previously, a single layer/painter could draw on both the main map and the borders by implementing FeaturePainter.paintBorderBody and paintBorderLabel. Those methods received a BorderPaintState, with border: RIAMap.Border.

New approach

With the map-borders toolbox component, you create a dedicated border layer for each border. That layer uses an internal BorderShapeProvider, which provides a shape for each model feature projected onto the border axis. Your painter implements the regular paintBody / paintLabel. It receives the already-projected shape in the reference of the border map, on the axis.

// 1) Implement a regular FeaturePainter; the incoming shape is the axis-projected shape
class MyBorderPainter extends FeaturePainter {
  paintBody(geoCanvas: GeoCanvas, feature: Feature, shape: Shape, layer: BorderFeatureLayer, map: RIAMap,
            paintState: PaintState) {
    // 'shape' lies on the border axis, expressed in the border map's reference
    // draw ticks, markers, or labels using the projected shape
  }

  paintLabel(labelCanvas: LabelCanvas, feature: Feature, shape: Shape, layer: BorderFeatureLayer, map: RIAMap,
             paintState: PaintState) {
    // optional: draw labels aligned to the axis-projected shape
  }
}

// 2) Create a border layer from an existing main layer and add it to the border map
const borderMap = borderedMap.getBorderMap("bottom");
const borderLayer = borderedMap.projectLayerToBorder(
    mainLayer,
    "bottom",
    new MyBorderPainter() // regular FeaturePainter implementation
);
if (borderMap && borderLayer) {
  borderMap.layerTree.addChild(borderLayer);
}

Migration

  • Implement a border painter first, re-using your previous logic. The painter’s shape argument is already projected onto the border axis in the border map reference:

    • paintBorderBody → paintBody

    • paintBorderLabel → paintLabel

  • Create a new border layer for each side you want to draw on, based on the original main-map layer, and supply your painter. Attach the layer to the corresponding border map. It will use a BorderShapeProvider internally.

Migrating from BorderLineStyle

The BorderLineStyle API has been removed. Previously, it was used to define how a line should be painted along a border axis, by specifying a color, width, and pixel offset from the axis, for example.

In the LuciadRIA Toolbox, you can now achieve this directly in the painter, using a regular ShapeStyle. You can apply any desired offset and draw the line with the standard geoCanvas.drawShape call.

paintBody(geoCanvas: GeoCanvas, feature: AirspaceFeature, shape: Shape, layer: BorderFeatureLayer) {
  if (isPolyline(shape)) {
    const offset = feature.properties.row + 10;
    shape.translate2D(0, offset);
    geoCanvas.drawShape(shape, {stroke: {color: "rgb(216,85,60)", width: 8}});
  }
}

Migrating from BorderIconStyle

The BorderIconStyle API, with the optional stem?: LineStyle, has been removed.

Migration

  • Draw the icon and its perpendicular stem in your painter on the main map.

  • Draw a long perpendicular stem toward the target border map. For example, to draw a stem that connects the icon to the bottom border map, specify a y-value below the visible range of the Y-axis. The main map will clip the line at the border map, making it appear to connect the feature to the axis.

Example: icon with a stem to the bottom border
paintBody(geoCanvas: GeoCanvas, _feature: Feature, shape: Polyline): void {
  geoCanvas.drawShape(shape, strokeStyle);

  for (let i = 0; i < shape.pointCount; i += 1) {
    const controlPoint = shape.getPoint(i);
    geoCanvas.drawIcon(controlPoint, iconStyle);

    // Perpendicular stem toward the bottom border; clipping trims it at the axis
    const stem = createPolyline(shape.reference, [[controlPoint.x, controlPoint.y], [controlPoint.x, -1e7]]);
    geoCanvas.drawShape(stem, strokeStemStyle);
  }
}

Drawing behavior on borders

When multiple borders are enabled, the left, bottom, and right borders for example, the border maps can overlap. The bottom border map extends beneath the areas covered by the left and right borders. In these overlapping regions, the bottom axis itself isn’t drawn - it’s rendered only along the section directly below the main map.

Previously, drawings on borders were automatically clipped to the visible part of the axis. In the new toolbox component, this clipping no longer happens automatically. Painters now receive the full projected shapes and must explicitly check whether a shape or point lies within the visible axis range before deciding to draw it.

This approach provides greater flexibility, for example, you can choose to draw elements extending beyond the axis, and it helps prevent visual artifacts caused by automatic clipping.

This code snippet shows how a painter can verify whether a point lies within the visible part of the axis before drawing:

paintBody(geoCanvas: GeoCanvas, _feature: Feature, shape: Polyline, layer: BorderFeatureLayer) {
  for (let i = 0; i < shape.pointCount; i += 1) {
    const pointOnAxis = shape.getPoint(i);
    if (layer.shapeProvider.isBorderPointInAxisRange(pointOnAxis)) {
      geoCanvas.drawIcon(pointOnAxis, iconStyle);
    }
  }
}

Border utilities

The BorderShapeProvider obtained from the layer provides three helper utilities for this purpose:

  • isBorderPointInAxisRange(point): checks if a point lies within the visible axis range.

  • getAxisStartPoint(): returns the start point of the visible axis.

  • getAxisEndPoint(): returns the end point of the visible axis.