Problems with conditional If/Else in GEE

38 Views Asked by At

I'm trying to Model urban sprawl using multitemporal data. I've imported landsat imagery collection (8,9,7,5,4) Then I created a composite function

`function landsat457 (roi , date ) {
 var col = filterCol ( landsat4 , roi , date ) .merge ( filterCol ( landsat5 , roi ,
 date ) ) .merge ( filterCol ( landsat7 , roi , date ) ) ;
 var image = col.map( cloudMaskTm ) .median () .clip (roi) ;
 return image ;
 }`

function landsat89 (roi , date ) { var col = filterCol ( landsat8 , roi , date ) .merge ( filterCol ( landsat9 , roi zzzzdate ) ) ; var image = col.map( cloudMaskOli ) .median () .clip (roi) ; return image ; }

And then I wanted to create a conditional on landsat to use. Here's my problem

`var landsat;
if (yearList < 2014) {
landsat = landsat457;
} else {
landsat = landsat89;
}`

This particular chunk gives me problems. There's a syntax error here and expected ')' and instead saw 'var'.

I tried to change the code but it didn't work

0

There are 0 best solutions below