Placement

The position of the title, scale bar, north arrow, source and legends is resolved by one function. See Placing elements for the accepted forms.

mappyng.position.resolve_position(position, vb)[source]

Resolve a position parameter to SVG pixel coordinates.

Parameters:
  • position (None, tuple, list or dict) – See the module docstring for the accepted forms.

  • vb (ViewBox) – Viewbox of the target viewport. Its crs is used for geographic positions.

Return type:

tuple[float, float] | None

Returns:

(x, y) (tuple of float, or None) – SVG pixel coordinates, or None when position is None.

Raises:

LayoutError – If position is malformed or cannot be projected.