Atlaslog
Atlaslog / Leaflet / API reference / Polygon
Leaflet · API reference

Polygon

Quick answer

L.polygon draws closed area features from an array of rings, where the first ring is the outer boundary and later rings cut holes through fillRule evenodd. It inherits every Path style option and adds fill specific behavior and ring accessors.

Last verified 2026-11-03 · Leaflet 1.9.4 · Cite this page
L.polygon( latlngs , options ) → Polygon
Key points
Example
var square = [
  [39.90, 116.38],
  [39.90, 116.42],
  [39.93, 116.42],
  [39.93, 116.38]
];

var withHole = [
  square,
  [[39.91, 116.39], [39.91, 116.41], [39.92, 116.41], [39.92, 116.39]]
];
var zone = L.polygon(withHole, {
  color: '#17694a',
  weight: 2,
  fillColor: '#17694a',
  fillOpacity: 0.25,
  fillRule: 'evenodd'
}).addTo(map);

zone.bindPopup('外环减去内环');

zone.on('click', function (e) {
  L.DomEvent.stopPropagation(e);
  zone.setStyle({ fillOpacity: 0.45 });
});
Notes
Runnable examplesChinese originalAll API references
English edition written for Atlaslog. Code is taken from the original Chinese page and runs unchanged.
Cite this page

Atlaslog (2026). Polygon. https://www.jingweizhi.com/en/leaflet/api/polygon.html (accessed 2026-11-03).