Search packages, repositories and app categories

Package detailsv1.0.1

polylabel

A fast algorithm for finding polygon pole of inaccessibility implemented as a Dart library. Useful for optimal placement of a text label on a polygon.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
368K
Likes
10
Pub points
160

Install package

flutter pub add polylabel

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

Polylabel is a Dart implementation of a fast algorithm to find the pole of inaccessibility of a polygon—the point inside the polygon farthest from any edge. This is particularly useful for placing text labels optimally within irregular shapes, ensuring maximum visibility and readability. The library is efficient and cross-platform, supporting all major operating systems. It's ideal for geographic applications, map visualization, and UI design where label positioning matters.

Use cases

  • Optimal label placement on maps
  • Finding center points for irregular polygons
  • Improving UI readability in complex layouts
  • Geospatial data visualization
  • Automated annotation in GIS applications

Key features

  • Fast computation of polygon poles
  • Cross-platform compatibility
  • Simple API for integration
  • Accurate results for concave and convex polygons
  • Lightweight and dependency-free

Suitable for

  • Map and GIS developers
  • UI/UX designers working with polygons
  • Applications requiring automated label positioning
  • Data visualization tools
  • Geospatial analysis projects

Considerations

  • Best suited for 2D planar polygons
  • Not optimized for extremely large or complex geometries
  • Requires input as closed polygon coordinates
  • Limited to single-polygon inputs
  • Performance may vary with high vertex counts

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

polylabel

build pub package pub points popularity likes

Dart port of https://github.com/mapbox/polylabel.

A fast algorithm for finding polygon pole of inaccessibility implemented as a Dart library. Useful for optimal placement of a text label on a polygon.

Usage

import 'dart:math';

import 'package:polylabel/polylabel.dart';

final polygon = [[Point(0, 0), Point(1, 0), Point(1, 1), Point(0, 1), Point(0, 0)]];
final result = polylabel(polygon); // PolylabelResult(Point(0.5, 0.5), distance: 0.5)

Categories

Dependencies

Dependency list 1 items

Source repository

Projects using this package