MGLMapSnapshotOptions


@interface MGLMapSnapshotOptions : NSObject

The options to use when creating images with the MGLMapSnapshotter.

  • Creates a set of options with the minimum required information.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithStyleURL:(nullable NSURL *)styleURL
                                      camera:(nonnull MGLMapCamera *)camera
                                        size:(CGSize)size;

    Swift

    init(styleURL: URL?, camera: MGLMapCamera, size: CGSize)

    Parameters

    styleURL

    URL of the map style to snapshot. The URL may be a full HTTP or HTTPS URL, a Mapbox URL indicating the style’s map ID (mapbox://styles/{user}/{style}), or a path to a local file relative to the application’s resource path. Specify nil for the default style.

    size

    The image size.

  • URL of the map style to snapshot.

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSURL *_Nonnull styleURL;

    Swift

    var styleURL: URL { get }
  • The zoom level.

    The default zoom level is 0. If this property is non-zero and the camera property is non-nil, the camera’s altitude is ignored in favor of this property’s value.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) double zoomLevel;

    Swift

    var zoomLevel: Double { get set }
  • A camera representing the viewport visible in the snapshot.

    If this property is non-nil and the coordinateBounds property is set to a non-empty coordinate bounds, the camera’s center coordinate and altitude are ignored in favor of the coordinateBounds property.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) MGLMapCamera *_Nonnull camera;

    Swift

    var camera: MGLMapCamera { get set }
  • The coordinate rectangle that encompasses the bounds to capture.

    If this property is non-empty and the camera property is non-nil, the camera’s center coordinate and altitude are ignored in favor of this property’s value.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) MGLCoordinateBounds coordinateBounds;

    Swift

    var coordinateBounds: MGLCoordinateBounds { get set }
  • The size of the output image, measured in points.

    Declaration

    Objective-C

    @property (readonly, nonatomic) CGSize size;

    Swift

    var size: CGSize { get }
  • The scale of the output image. Defaults to the main screen scale.

    The minimum scale is 1.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGFloat scale;

    Swift

    var scale: CGFloat { get set }