iOS SDK

API Reference

On This Page

MGLMapSnapshotOptions

@interface MGLMapSnapshotOptions : NSObject <NSCopying>

The options to use when creating images with the MGLMapSnapshotter.

-initWithStyleURL:camera:size:

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 style URL (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.

Configuring the Map

styleURL

URL of the map style to snapshot.

Declaration

Objective-C

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

Swift

var styleURL: URL { get }

zoomLevel

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 (nonatomic, assign, unsafe_unretained, readwrite) double zoomLevel;

Swift

var zoomLevel: Double { get set }

camera

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 (nonatomic, assign, unsafe_unretained, readwrite)
MGLMapCamera *_Nonnull camera;

Swift

var camera: MGLMapCamera { get set }

coordinateBounds

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 (nonatomic, assign, unsafe_unretained, readwrite)
MGLCoordinateBounds coordinateBounds;

Swift

var coordinateBounds: MGLCoordinateBounds { get set }

Configuring the Image

size

The size of the output image, measured in points.

Declaration

Objective-C

@property (nonatomic, readonly) CGSize size;

Swift

var size: CGSize { get }

scale

The scale of the output image. Defaults to the main screen scale.

The minimum scale is 1.

Declaration

Objective-C

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

Swift

var scale: CGFloat { get set }