Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async takeSnapshot (aoi) {
const { imageHeight: height, width } = this.state
// MapboxGL expects these as [[maxX, maxY], [minX, minY]]
const bounds = [[aoi[2], aoi[3]], [aoi[0], aoi[1]]]
try {
const uri = await MapboxGL.snapshotManager.takeSnap({
bounds,
width,
height,
styleURL: osmStyleURL
})
this.setState({
preview: uri
})
} catch (err) {
console.log('failed to take snapshot:', err)
}
}