Polygon Layer
Last updated
Last updated
© flutter_map Authors & Maintainers
You can add areas/shapes to maps by making them out of individual coordinates using PolygonLayer
and Polygon
s.
Excessive use of polygons may create performance issues.
Consider enabling polygonCulling
. This will prevent the calculation and rendering of polygons outside of the current viewport, however this may not work as expected in all situations.
'flutter_map' doesn't provide any public methods to manipulate polygons, as these would be deemed out of scope.
However, some useful methods can be found in libraries such as 'latlong2' and 'poly_bool_dart'. These can be applied to the input of Polygon
's points
argument, and the map will do it's best to try to render them. However, more complex polygons - such as those with holes - may be painted inaccurately, and may therefore require manual adjustment (of holePointsList
, for example).
onTap
There is no support for handling taps on polygons, due to multiple technical challenges. To stay up to date with this existing feature request, see the linked issue.