Skip to main content
layers

Circle Layer

CircleLayer draws circles with CircleMarker, in two flavours:

  • useRadiusInMeter: true — a geographic circle: it covers the same ground at every zoom, so it grows and shrinks on the screen as the zoom changes;
  • useRadiusInMeter: false (default) — a pixel circle: it keeps its size on screen at every zoom, as in flutter_map.
CircleLayer(
  circles: [
    CircleMarker(point: position, radius: 12, color: Color(0x6600B0FF), borderStrokeWidth: 1),
  ],
)

The demo is someone walking in Strasbourg, on the Europe tab: the accuracy circle grows and shrinks with the GPS precision, centred on the location:

Apple MapKit (iOS)Google Maps (Android)
The accuracy circle pulsing around a locationThe accuracy circle pulsing around a location, on Google Maps

How each flavour is drawn​

A metre radius is a native circle; a pixel radius has no native equivalent — a native circle is a ground shape, and its radius would have to be recomputed at every frame to hold its size on screen — so the core rasterises the circle (fill and border) and publishes it as a marker anchored at its centre:

Android (Google Maps)iOS, macOS (MapKit)Web, Windows, Linux (flutter_map)
useRadiusInMeter: truenative CircleMKCircleflutter_map's circle
useRadiusInMeter: falsemarker with a rasterised discmarker with a rasterised discflutter_map's circle

Two things follow from a pixel circle being a marker on the native maps:

  • it is drawn in the marker plane, so it covers the polylines and polygons of the layers under it whatever their order, where a metre circle sits among the shapes;
  • it holds its radius exactly through a pinch, because nothing about it is measured in metres.

Taps​

A circle is never tappable on the platform, in either flavour: a tap is resolved in Dart through the layer's hit tester. Pass a hitNotifier to CircleLayer and read the tapped circle in MapOptions.onTap.