Legacy
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.
MultiPolygon
Extends FeatureGroup to allow creating multi-polygons (single layer that consists of several polygons that share styling/popup).
Creation
Factory | Description |
---|---|
L.multiPolygon(
|
Instantiates a multi-polygon object given an array of latlngs arrays (one for each individual polygon) and optionally an options object (the same as for MultiPolyline). |
Methods
MultiPolygons accept all Polyline methods but have different behavior around their coordinate contents since they can contain multiple polygon features:
Method | Returns | Description |
---|---|---|
setLatLngs(
|
this |
Replace all polygons and their paths with the given array of arrays of geographical points. |
getLatLngs() |
|
Returns an array of arrays of geographical points in each polygon. |
openPopup() |
this |
Opens the popup previously bound by bindPopup. |
toGeoJSON() |
Object |
Returns a GeoJSON representation of the multipolygon (GeoJSON MultiPolygon Feature). |