polylabel2D method
DistancedPosition<Position>
polylabel2D({
- double precision = 1.0,
- PositionScheme scheme = Position.scheme,
Calculates polylabel for this polygon.
The polylabel is a fast algorithm for finding polygon
pole of inaccessibility, the most distant internal point from the
polygon exterior ring (not to be confused with centroid).
Use precision to set the precision for calculations (by default 1.0).
Use scheme to set the position scheme:
Position.schemefor generic position data (geographic, projected or any other), this is also the defaultProjected.schemefor projected position dataGeographic.schemefor geographic position data
Examples:
// A polygon geometry (with an exterior ring and one interior ring as a hole).
final polygon = Polygon.build([
[35.0, 10.0, 45.0, 45.0, 15.0, 40.0, 10.0, 20.0, 35.0, 10.0],
[20.0, 30.0, 35.0, 35.0, 30.0, 20.0, 20.0, 30.0],
]);
// Prints: "Polylabel pos: 17.65625,24.21875 dist: 5.745242597140699"
final p = polygon.polylabel2D(precision: 2.0);
print('Polylabel pos: ${p.position} dist: ${p.distance}');
See also CartesianArealExtension.polylabel2D.
Implementation
DistancedPosition polylabel2D({
double precision = 1.0,
PositionScheme scheme = Position.scheme,
}) =>
_rings.polylabel2D(
precision: precision,
scheme: scheme,
);