multiPolygonToSvgPath

Chart
stable

Converts a multi-polygon (array of [lng, lat] polygon arrays) into a single SVG path string with multiple M…Z subpaths. Each polygon is projected via mercatorProject.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

multi
required
Array<Array<[number, number]>>
Multi-polygon data: outer array is a list of polygons, each polygon is an array of [lng, lat] geographic pairs.
width
number
1000
SVG canvas width in pixels.
height
number
500
SVG canvas height in pixels.

API

Return value

The value returned by this util.

A single SVG d attribute string containing one closed M…Z subpath per polygon, separated by spaces.

Usage

Examples

Ready-to-paste usage snippets.

Render a country on an SVG map

typescript