Skip to main content

Polyline

The Polyline component draws lines on the map connecting multiple coordinate points. Useful for routes, paths, and connections.

Props

Array<{ lat: number; lng: number }>
required
Array of coordinates defining the polyline path
object
Polyline styling and behavior options

Basic Usage

Styled Polyline

Dashed Line

Multiple Routes

Drawing Path with Markers

Dynamic Polyline

Use Cases

Routes

Display navigation routes between locations

Boundaries

Show property or region boundaries

Trails

Visualize hiking or biking trails

Connections

Connect related points or locations

Performance Tips

For paths with many points, consider simplifying using the Douglas-Peucker algorithm to reduce the number of coordinates while maintaining visual accuracy.
When updating polylines dynamically, batch coordinate changes instead of updating on every point change.
Remove or don’t render polylines that are outside the visible map bounds.

See Also

Polygon

Draw filled polygons

Marker

Add markers to polyline endpoints

Examples

Interactive examples