Skip to content

Instantly share code, notes, and snippets.

@lloydsheng
Last active March 19, 2018 08:10
Show Gist options
  • Save lloydsheng/b7ec1375e9b79fa4d8f49c4a45070a13 to your computer and use it in GitHub Desktop.
Save lloydsheng/b7ec1375e9b79fa4d8f49c4a45070a13 to your computer and use it in GitHub Desktop.
let centerLocation = CLLocationCoordinate2D(latitude: 0, longitude: 66)
let styleURL = URL(string: "mapbox://styles/lloydsheng/cjdjzspzq5b4b2sobtqxeooll")
let camera = MGLMapCamera(lookingAtCenter: centerLocation, fromDistance: 100, pitch: 0, heading: 0)
let options = MGLMapSnapshotOptions(styleURL: styleURL, camera: camera, size: CGSize(width: 300, height: 300))
let snapShooter = MGLMapSnapshotter(options: options)
snapShooter.start { (shooter, error) in
let image = shooter?.image;
print("\(image)")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment