polylabel.md
February 10, 2026 ยท View on GitHub
Polylabel
Description
A fast algorithm for finding polygon pole of inaccessibility, the most distant internal point from the polygon outline (not to be confused with centroid), implemented as a JavaScript library. Useful for optimal placement of a text label on a polygon.
Usage
import { polylabels, polylabel } from 'gis-tools-ts';
import type { VectorMultiPolygon } from 'gis-tools-ts';
// for vector multipolygons:
const vectorGeometry: VectorMultiPolygon = [];
const polylabelHighPrecision = polylabels(vectorGeometry, 1);
// for a single polygon:
const vectorGeometry: VectorPolygon = [];
const polylabelHighPrecision = polylabel(vectorGeometry, 1);