Documentation menu
Ola Maps
Developer Docs
  • Overview
  • Authentication
  • Multilingual Language Support
      • SDK Setup
      • Adding Markers
      • Events & Controls
      • Static Maps
      • Geolocation
      • Adding Shapes
      • Marker Clustering
      • Heatmap Layer
      • Ground Overlays
      • Custom Overlays
  • Street View
Developer guides

Ola Maps Web SDK v1 - Adding Shapes (Polylines & Polygons)

Important Notice
The Web SDK v1 support ended on March 31, 2026. We will no longer be providing any support for Web SDK v1. Please migrate to our Web SDK v2 for new features and improvements, and continued support.
Migrate to Web SDK v2
This documentation provides methods for adding polyline and polygons in map.

Adding Polyline

Add a GeoJSON line to map using addSource map method and style it using addLayer’s paint properties.

Example

Adding Polygon

Add a GeoJSON polygon to map using addSource map method and style it using addLayer’s paint fill layer properties.

Example