package to access sentinel open data by Sentinel HUB
npm install --save sentinelhub
or
yarn install sentinelhub
You must create OAuth Client by Sentinel HUB Dashboard
const sentinelhub = require('sentinelhub');
sentinelHUB.getToken(clientID, clientSecret, (err, token) => {
....
});
const sentinelhub = require('sentinelhub');
const options = {
token: <YOUR OAUTH TOKEN>,
evalscript: <custom evalscript v3>,
bbox: [13,45,15,47],
fromUTC: '2019-04-01T00:00:00Z',
toUTC: '2019-06-30T00:00:00Z',
width: 512,
height: 512
};
const tobase64 = false;
sentinelAPI.runProcess(options, (err, blob_image) => {
if (err == null) {
blob_image.arrayBuffer().then((buf) => {
if (tobase64) {
return Buffer.from(buf).toString('base64');
} else {
return Buffer.from(buf);
}
});
} else {
console.error(err)
}
});