--- layout: api title: "v1.6.1 API: L.Polygon" categories: api version: v1.6.1 permalink: /api/v1.6.1/l-polygon ---
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(
|
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). |