0

i tried to visualize the regression from random forest, but it cannon appear in console or map, the variable predictor has been export by same scale and crs. why this is happen?

// Display the input imagery and the regression classification.
   //get dictionaries of min & max predicted value
  var regressionMin = (regression.reduceRegion({
    reducer: ee.Reducer.min(),
    scale: 30, 
    crs: crs,
    bestEffort: true,
    tileScale: 5
  }));
  var regressionMax = (regression.reduceRegion({
    reducer: ee.Reducer.max(),
    scale: 30, 
    crs: crs,
    bestEffort: true,
    tileScale: 5
  }));


// Add to map
var viz = {palette: palette, min: regressionMin.getNumber('predicted').getInfo(), max: regressionMax.getNumber('predicted').getInfo()};
Map.addLayer(regression, viz, 'Regression');

here is the script of my project it happens in line 177

1
  • Adding the code is not enough for explaining your problem. Add some context of your code and the error you are facing.
    – Padmanabha
    Commented Sep 30, 2023 at 6:57

1 Answer 1

0

reduceRegion produces a single number; you shouldn't be trying to display in on a map. Just print it.

For anyone else to be able to help you, you will need to shre your assets, simplify your script and post a complete example (not a link).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.