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

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

Paramètres d'entrée acceptés par cet util.

multi
requis
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

Valeur de retour

La valeur retournée par cet util.

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

Usage

Exemples

Extraits de code prêts à coller.

Render a country on an SVG map

typescript