flutter_map Docs
Project Links๐Ÿ’ Support Us
v6
v6
  • flutter_map
  • ๐Ÿ—๏ธShowcase
  • ๐Ÿ’Supporters
  • โœ๏ธCredits & Contributing
  • Getting Started
    • How Does It Work?
      • Raster vs Vector Tiles
    • Demonstration
    • Installation
    • Examples
    • Migrating To v6
  • Usage
    • Base Widget
    • Options
      • Interaction Options
    • Layers
    • Programmatic Control
      • Control Camera
      • Get Camera
      • Listen To Events
    • Full API Reference
  • Layers
    • Tile Layer
      • Tile Providers
      • WMS Usage
    • Marker Layer
    • Polygon Layer
    • Polyline Layer
    • Circle Layer
    • Overlay Image Layer
    • Attribution Layer
  • Tile Servers
    • Using Mapbox
    • Using Thunderforest
    • Using Stadia Maps
    • Using Bing Maps
    • Offline Mapping
    • Other Options
  • Plugins
    • Plugins List
    • Creating A Plugin
      • Creating New Tile Providers
      • Creating New Layers
Powered by GitBook

ยฉ flutter_map Authors & Maintainers

On this page
  • Polygon Manipulation
  • onTap Support

Was this helpful?

Export as PDF
  1. Layers

Polygon Layer

PreviousMarker LayerNextPolyline Layer

Last updated 1 year ago

Was this helpful?

You can add areas/shapes to maps by making them out of individual coordinates using PolygonLayer and Polygons.

PolygonLayer(
  polygons: [
    Polygon(
      points: [LatLng(30, 40), LatLng(20, 50), LatLng(25, 45)],
      color: Colors.blue,
      isFilled: true,
    ),
  ],
),

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.

Polygon Manipulation

'flutter_map' doesn't provide any public methods to manipulate polygons, as these would be deemed out of scope.

onTap Support

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.

However, some useful methods can be found in libraries such as 'latlong2' and . 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).

'poly_bool_dart'
An example Polygon
PolygonLayer class - flutter_map library - Dart API
Logo
Polygon onTap? ยท Issue #385 ยท fleaflet/flutter_mapGitHub
Polygon class - flutter_map library - Dart API
Logo
Logo