@interface MGLMultiPolygon : MGLShape <MGLOverlay>

An MGLMultiPolygon object represents a shape consisting of one or more polygons that do not overlap. For example, you could use a multipolygon shape to represent the body of land that consists of an island surrounded by an atoll: the inner island would be one MGLPolygon object, while the surrounding atoll would be another. You could also use a multipolygon shape to represent a group of disconnected but related buildings.

You can add multipolygon shapes to the map by adding them to an MGLShapeSource object. Configure the appearance of an MGLShapeSource’s or MGLVectorTileSource’s multipolygons collectively using an MGLFillStyleLayer or MGLSymbolStyleLayer object.

You cannot add an MGLMultiPolygon object directly to a map view using -[MGLMapView addAnnotation:] or -[MGLMapView addOverlay:]. However, you can add the polygons array’s items as overlays individually.

  • An array of polygons forming the multipolygon.



    @property (nonatomic, copy, readonly) NSArray<MGLPolygon *> *_Nonnull polygons;


    var polygons: [MGLPolygon] { get }
  • Creates and returns a multipolygon object consisting of the given polygons.



    + (nonnull instancetype)multiPolygonWithPolygons:
        (nonnull NSArray<MGLPolygon *> *)polygons;


    convenience init(polygons: [MGLPolygon])



    The array of polygons defining the shape.

    Return Value

    A new multipolygon object.