Hi all,
I am a 5th year architecture student @ Cornell, and for my thesis I am dealing w/ UHI, inequality in thermal stress and other types of comfort in Phoenix.
I want to do some thermal mapping with Landsat, and while the default script is good, it is in K, and not adapted for true surface mapping I believe. I found this script from the github by Mohor Gartner:
Land Surface Temperature (LST) Mapping Script
A repository of custom scripts that can be used with Sentinel-Hub services.
I am having some trouble though, since I am very new at coding…
Namely, I just want to be able to add legend data to the script so that when I download an image, there is a legend…
And I want to change the color scale, when I try to change this line :
let viz = ColorGradientVisualizer.createRedTemperature(minC, maxC);
particularly, the “Red” portion to change the colors, I see there are these available scales here :
greenWhite
BlueRed
redTemperature
and more…
but when I sub in for a different color, I get this error:
Failed to evaluate script!
evalscript.js:46: TypeError: ColorGradientVisualizer.createblueRedTemperature is not a function
let viz = ColorGradientVisualizer.createblueRedTemperature(minC, maxC);
^
TypeError: ColorGradientVisualizer.createblueRedTemperature is not a function
at evalscript.js:46:35
In addition, there are some other issues in the script editor, that I do not know how to fix :
I know there it does not matter much since it is // out, but what does the ? mean?
at line 139, I get an error “i is already defined”
// calc final stdev value
for (var i=0;i<LSTarray.length;i++) {
LSTstd=LSTstd+(Math.pow(LSTarray[i]-LSTavg, 2));
}
LSTstd=(Math.pow(LSTstd/(LSTarray.length-1), 0.5));
At line 146, and 148 I get an error "Misleading Line break at ‘?’
// WHICH LST to output, it depends on option variable: 0 for one image analysis (OE Browser); MULTI-TEMPORAL: 0->avg; 1->max; 2->stdev
let outLST= (option==0)
? LSTavg
: (option==1)
? LSTmax
: LSTstd;
In the first lines of the script there are 3 functions to choose from :
// for analysis of one image (OE Browser), choose option=0. In case of MULTI-TEMPORAL analyis, option values are following:
// 0 - outputs average LST in selected timeline (% of cloud coverage should be low, e.g. < 10%)
// 1�- outputs maximum LST in selected timeline (% of cloud coverage can be high)
// 2 - outputs standard deviation LST in selected timeline; minTemp and highTemp are overwritten with values 0 and 10 (% of cloud coverage should be low, e.g. < 5%)
var option = 1;
If I change var option = 1 though to 0, or 1, or 2, the output is always the same. Is there somewhere else I am suppose to change this in the script too? or why is it not working?
Thanks in advance, from a newbie coder.

