Mapbox.js is no longer in active development. To learn more about our newer mapping tools see Mapbox GL JS.

You are viewing an older version of Mapbox.js. Check out v3.3.1 for the latest.


A class for drawing polygon overlays on a map. Extends Polyline. Use Map#addLayer to add it to the map.

Note that points you pass when creating a polygon shouldn't have an additional last point equal to the first one — it's better to filter out such points.


Factory Description
L.polygon( <LatLng[]> latlngs, <Polyline options> options? ) Instantiates a polygon object given an array of geographical points and optionally an options object (the same as for Polyline). You can also create a polygon with holes by passing an array of arrays of latlngs, with the first latlngs array representing the exterior ring while the remaining represent the holes inside.


Polygon has the same options and methods as Polyline, with the following differences:

Method Returns Description
toGeoJSON() Object Returns a GeoJSON representation of the polygon (GeoJSON Polygon Feature).