Shapes

Draw polygons and circles on the map for boundaries, zones, and service areas.

Use MapPolygon to draw filled areas defined by a list of coordinates, and MapCircle to draw a circle with a given center and radius. Both support hover and click interactions and reactive style updates.

Example

The blue rectangle outlines a central Beijing area, the red polygon marks the Forbidden City, and the green circle shows a 500 m radius around Tiananmen. Hover or click each shape to identify it.

MapPolygon

Draws a filled polygon on the map. Must be used inside Map. Requires at least 3 coordinate pairs.

PropTypeDefaultDescription
coordinates[number, number][]Array of [longitude, latitude] pairs defining the polygon (min 3 points).
fillColorstring"#3b82f6"Fill color (CSS color value).
fillOpacitynumber0.3Fill opacity (0 to 1).
strokeColorstring"#3b82f6"Stroke/border color.
strokeWidthnumber2Stroke width in pixels.
strokeOpacitynumber0.8Stroke opacity (0 to 1).
onClick() => voidCallback when the polygon is clicked.
onMouseEnter() => voidCallback when the mouse enters the polygon.
onMouseLeave() => voidCallback when the mouse leaves the polygon.

MapCircle

Draws a circle with a given center and radius. Must be used inside Map. Useful for service radius, geofencing, and proximity visualization.

PropTypeDefaultDescription
center[number, number]Circle center [longitude, latitude] in GCJ-02.
radiusnumberRadius in meters.
fillColorstring"#3b82f6"Fill color.
fillOpacitynumber0.2Fill opacity (0 to 1).
strokeColorstring"#3b82f6"Stroke color.
strokeWidthnumber2Stroke width in pixels.
strokeOpacitynumber0.8Stroke opacity (0 to 1).
onClick() => voidCallback when the circle is clicked.
onMouseEnter() => voidCallback when the mouse enters the circle.
onMouseLeave() => voidCallback when the mouse leaves the circle.