Extracting NDVI for Landcover Classes in Google Earth Engine

Geographic Information Systems Asked by Ian Dershem on August 8, 2020

I am working on a project where I have created a supervised classification of an image which contains four land cover classes. I have reduced the classification to a frequency histogram that displays the percent land cover taken up by the image, however, I now want to get the NDVI mean for each land cover class.

Using a reducer seems to be the most likely approach but I am not sure how to reduce and match NDVI values associated with each class in this case. The frequency histogram reduction yields the resulting pixel counts:

classification: Object (4 properties)
0: 15330.674509803957
1: 7207.431372549016
2: 71314.45098039194
3: 3969.709803921568

Ideally, I would get an object that looks like this:

classification: Object (4 properties)
0: {pixel_count: 15330.674509803957, NDVI: ...}
1: {pixel_count: 7207.431372549016, NDVI: ...}
2: {pixel_count: 71314.45098039194, NDVI: ...}
3: {pixel_count: 3969.709803921568, NDVI: ...}

Does anyone know what the best way to go about computing this reduction would be?

Thanks for any help!

One Answer

I'm still interested to know if there is a simple reduction method that could do this, however, I did find a workaround.

I used my land cover classification band to create a mask and computed the NDVI for the image for a series of different masks to limit the land cover type for which I was calculating the NDVI value for.

Answered by Ian Dershem on August 8, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP