Forest Change Analysis in Google Earth Engine [GEE]
HTML-код
- Опубликовано: 3 окт 2024
- 🌳🌱🍄🐌🏞🌲🐛☘️🍃
This is the following attempt of the guide already available about the global forest change analysis.
---A summary about the process and codes.
---Codes are from the developers.google.com.
---
Introduction to Forest Change Analysis in Earth Engine
Link: developers.goo...
---
High-Resolution Global Maps of 21st-Century Forest Cover Change
www.researchga...
---
Hope this is helpful for your further learning.
Any comments/suggestions regarding the explanations are welcomed.
Thankyou!
---
#GoogleEarthEngine
#GEE
#ForestChangeAnalysis
🌱🍄🌻🥞🌿🌷🍎🍀
Great effort, and good work! Kindly can you share with me the codes, kindly
You can easily find them in the developers.google.com along with the more detailed explanations (developers.google.cn/earth-engine/tutorials/tutorial_forest_01?hl=zh-cn).
The aim in the video was to summarize the three tutorial pages in the quick possible manner.
Thanks for the comments. :-)
@@ksabmagar7 thank you, when you are making the chart, is it possible to develop combined chart for both 'lost per year' and 'gain' per year to compare the two? How please
Probably yes, if we check the bands of the dataset, there is a band valled gain. It says there that the band has not updated after 2012. We can probably work on that one.
@@phestoosano1294 Hi there, did you manage to do it?
@@ksabmagar7 I did not manage, but I got a code that have separated loss and gain,, maybe I can share it with you
Thank you for the video, it was really helpful!
I just have one question:
In my case I have a shapefile with 3 polygons and if I follow your steps I get the results for the total area comprised by the 3 of them. How could I get the results separately, without having to repeat the entire code 3 times? Is there a way to perform a loop or just give a command telling we need discrete outputs for the multipolygon?
In your study case, it would be the equivalent if you wanted to get results simultaneously for other countries, instead of just Nepal, for example.
Thanks in advance!
Thankyou for the comment.
The best will be to follow this nicely blog article covering all the things about the area calculation (if you did not know earlier). spatialthoughts.com/2020/06/19/calculating-area-gee/
You can surely adapt that section - Area Calculation by Class by Region or other sections- from the blog. But, surely depends on how to... This will be helpful when there will be lots of regions.
Also, my simple attempt will be to change that section, that area calculating part into function. after line 98 in video, OR first code section from the page developers.google.cn/earth-engine/tutorials/tutorial_forest_03a. But this will still require us to write that function name each time. Luckily, three shape files only.
////
var AreaCalc = function(shpfile){
var lossByYear = lossAreaImage.addBands(lossYear).reduceRegion({
reducer: ee.Reducer.sum().group({
groupField: 1
}),
geometry: shpfile,
scale: 30,
maxPixels: 1e9
});
var statsFormatted = ee.List(lossByYear.get('groups'))
.map(function(el) {
var d = ee.Dictionary(el);
return [ee.Number(d.get('group')).format("20%02d"), d.get('sum')];
});
var statsDictionary = ee.Dictionary(statsFormatted.flatten());
return statsDictionary
};
print(AreaCalc(table))
print(AreaCalc(table2))
print(AreaCalc(table3));
/////
Hope the reply helps,
@@ksabmagar7
Thank you for the careful reply!
I'm a beginner in GEE, so I'm having the classical struggles on getting used to the new syntax.
So, I'm sorry if the question is too basic:
But on the end of the code you sent, by mentioning "table, table 2 and table 3", aren't you assuming that the shapefiles were uploaded separately? In my case, I have a single shp with the boundaries of 3 national parks. So it would be the equivalent of, in your video, trying to get the yearly results for all countries of the global database. And then plot the individual diagrams for each of them, or to have the output as an csv file to plot the diagrams on R.
It is a bit blurry to me where in your code you define how the grouping shoud be made - I see "geometry: shpfile", but shouldn't it be stated somewhere the identifying column? (e.g. name of the country or reserve)? I am not sure if that is the aim in "lossByYear.get('groups')", but my guess would be that the groups should be stated from the boundaries shapefile, instead of from the forest cover dataset.
Thanks for the kindness and patience!
Yes, the tables mean different uploaded shapefiles. I was assuming you have three shape files.
If your shapefile is only one, just repeat the above process with filtering them with ee.Filter.eq, to get each polygon.
geometry: shpfile is just the parameter that function will take.
print(AreaCalc(table.filter(ee.Filter....))) //to first national park
print(AreaCalc(table.filter(ee.Filter....))) // 2nd and so on
something like this to get the area three times.
We are not doing anything with the 'groups' here. It gets confusing when the structures are changed from array to dictionary, or vice versa and etc. We are just trying to reduce the need to repeat the codes.
You can store them in the variables for sure and continue what has been done, but requires to repeat three times again. Or make the function for that as well. You can draw all the chart in earthengine.
---
The basic attempt was to not to repeat the bulk of codes each times. Rather a function was made to reduce it to not copy again, and call it three times.
Also, adapting codes from the blog can be difficult as I was pointing out.
I hope I am not confusing you more.
@@ksabmagar7 Perfect! Thank you very very much for your assistance!!
Great if it worked.
Later, may be you can try that blog article incase if you need to do it for more than 3 or 30 different national parks. Repeating that line by line/filtering, again will be tedious.
Thankyou for being around.
how did you know that the value of masPixels should be 1e10? Could you tell me the value for India please?
The max pixels lets to know how many pixels to be used for computation. The 1e10 is the default value earth engine takes, there is no such value to be used for the country or region. Check how many pixels are in the region, if it crosses 10 million, there is the error.
great thanks
I would like to learn about your site Hydrolgical analysis please let me know
Hi, thanks for the comment.
There might not be such content in particular for the hydrological analysis. We can takes small pieces of codes and try applying for the analysis for the needed purpose.
Hope my comment helps.
Thanks for the subscribe.