Flood Mapping Google Earth Engine Using Sentinel SAR Satellite Imagery

Поділитися
Вставка
  • Опубліковано 10 лют 2025
  • In this video, we explore the powerful capabilities of Google Earth Engine and Sentinel SAR dataset for flood mapping and assessment. Using remote sensing data and advanced techniques, we demonstrate how to quickly and accurately identify flooded areas, estimate flood extent and analyze flood dynamics over time.
    We begin by introducing the basics of Sentinel SAR data and Google Earth Engine, and then move on to applying these tools for flood mapping and assessment. We showcase several examples of how these techniques have been used in real-world scenarios, such as during natural disasters and for environmental monitoring.
    Our step-by-step guide will help you to gain a deeper understanding of how to use Google Earth Engine and Sentinel SAR data to analyze and visualize flood patterns. We also discuss the importance of accurate flood mapping and how it can help to mitigate the impact of floods on local communities.
    Whether you are a researcher, student or someone interested in learning more about flood mapping and assessment, this video is a must-watch. Join us on this journey as we uncover the potential of Google Earth Engine and Sentinel SAR data for flood analysis.
    -check comments for the Function code and links for feature boundary!!

КОМЕНТАРІ • 43

  • @createbyte
    @createbyte  Рік тому +6

    -Get Feature Boundary from:
    data.humdata.org/dataset/pakistan-union-council-boundaries-along-with-other-admin-boundaries-dataset
    -Functions code:
    //declared function to convert the images types and perform the functions
    // Function to convert from d
    function toNatural(img) {
    return ee.Image(10.0).pow(img.select(0).divide(10.0));
    }
    //Function to convert to dB
    function toDB(img) {
    return ee.Image(img).log10().multiply(10.0);
    }
    //Apllying a Refined Lee Speckle filter as coded in the SNAP 3.0 S1TBX:
    //github.com/senbox-org/s1tbx/blob/master/s1tbx-op-sar-processing/src/main/java/org/esa/s1tbx/sar/gpf/filtering/SpeckleFilters/RefinedLee.java
    //Adapted by Guido Lemoine
    // by Guido Lemoine
    function RefinedLee(img) {
    // img must be in natural units, i.e. not in dB!
    // Set up 3x3 kernels
    var weights3 = ee.List.repeat(ee.List.repeat(1,3),3);
    var kernel3 = ee.Kernel.fixed(3,3, weights3, 1, 1, false);
    var mean3 = img.reduceNeighborhood(ee.Reducer.mean(), kernel3);
    var variance3 = img.reduceNeighborhood(ee.Reducer.variance(), kernel3);
    // Use a sample of the 3x3 windows inside a 7x7 windows to determine gradients and directions
    var sample_weights = ee.List([[0,0,0,0,0,0,0], [0,1,0,1,0,1,0],[0,0,0,0,0,0,0], [0,1,0,1,0,1,0], [0,0,0,0,0,0,0], [0,1,0,1,0,1,0],[0,0,0,0,0,0,0]]);
    var sample_kernel = ee.Kernel.fixed(7,7, sample_weights, 3,3, false);
    // Calculate mean and variance for the sampled windows and store as 9 bands
    var sample_mean = mean3.neighborhoodToBands(sample_kernel);
    var sample_var = variance3.neighborhoodToBands(sample_kernel);
    // Determine the 4 gradients for the sampled windows
    var gradients = sample_mean.select(1).subtract(sample_mean.select(7)).abs();
    gradients = gradients.addBands(sample_mean.select(6).subtract(sample_mean.select(2)).abs());
    gradients = gradients.addBands(sample_mean.select(3).subtract(sample_mean.select(5)).abs());
    gradients = gradients.addBands(sample_mean.select(0).subtract(sample_mean.select(8)).abs());
    // And find the maximum gradient amongst gradient bands
    var max_gradient = gradients.reduce(ee.Reducer.max());
    // Create a mask for band pixels that are the maximum gradient
    var gradmask = gradients.eq(max_gradient);
    // duplicate gradmask bands: each gradient represents 2 directions
    gradmask = gradmask.addBands(gradmask);
    // Determine the 8 directions
    var directions = sample_mean.select(1).subtract(sample_mean.select(4)).gt(sample_mean.select(4).subtract(sample_mean.select(7))).multiply(1);
    directions = directions.addBands(sample_mean.select(6).subtract(sample_mean.select(4)).gt(sample_mean.select(4).subtract(sample_mean.select(2))).multiply(2));
    directions = directions.addBands(sample_mean.select(3).subtract(sample_mean.select(4)).gt(sample_mean.select(4).subtract(sample_mean.select(5))).multiply(3));
    directions = directions.addBands(sample_mean.select(0).subtract(sample_mean.select(4)).gt(sample_mean.select(4).subtract(sample_mean.select(8))).multiply(4));
    // The next 4 are the not() of the previous 4
    directions = directions.addBands(directions.select(0).not().multiply(5));
    directions = directions.addBands(directions.select(1).not().multiply(6));
    directions = directions.addBands(directions.select(2).not().multiply(7));
    directions = directions.addBands(directions.select(3).not().multiply(8));
    // Mask all values that are not 1-8
    directions = directions.updateMask(gradmask);
    // "collapse" the stack into a singe band image (due to masking, each pixel has just one value (1-8) in it's directional band, and is otherwise masked)
    directions = directions.reduce(ee.Reducer.sum());
    //var pal = ['ffffff','ff0000','ffff00', '00ff00', '00ffff', '0000ff', 'ff00ff', '000000'];
    //Map.addLayer(directions.reduce(ee.Reducer.sum()), {min:1, max:8, palette: pal}, 'Directions', false);
    var sample_stats = sample_var.divide(sample_mean.multiply(sample_mean));
    // Calculate localNoiseVariance
    var sigmaV = sample_stats.toArray().arraySort().arraySlice(0,0,5).arrayReduce(ee.Reducer.mean(), [0]);
    // Set up the 7*7 kernels for directional statistics
    var rect_weights = ee.List.repeat(ee.List.repeat(0,7),3).cat(ee.List.repeat(ee.List.repeat(1,7),4));
    var diag_weights = ee.List([[1,0,0,0,0,0,0], [1,1,0,0,0,0,0], [1,1,1,0,0,0,0],
    [1,1,1,1,0,0,0], [1,1,1,1,1,0,0], [1,1,1,1,1,1,0], [1,1,1,1,1,1,1]]);
    var rect_kernel = ee.Kernel.fixed(7,7, rect_weights, 3, 3, false);
    var diag_kernel = ee.Kernel.fixed(7,7, diag_weights, 3, 3, false);
    // Create stacks for mean and variance using the original kernels. Mask with relevant direction.
    var dir_mean = img.reduceNeighborhood(ee.Reducer.mean(), rect_kernel).updateMask(directions.eq(1));
    var dir_var = img.reduceNeighborhood(ee.Reducer.variance(), rect_kernel).updateMask(directions.eq(1));
    dir_mean = dir_mean.addBands(img.reduceNeighborhood(ee.Reducer.mean(), diag_kernel).updateMask(directions.eq(2)));
    dir_var = dir_var.addBands(img.reduceNeighborhood(ee.Reducer.variance(), diag_kernel).updateMask(directions.eq(2)));
    // and add the bands for rotated kernels
    for (var i=1; i

  • @PlannerSajad
    @PlannerSajad Рік тому +1

    Wonderful Sir, this video helped me a lot for my class report on "Impact of Flood and their mitigation strategies in Sindh " thank you Sir for your guidelines..... i really appreciate it....

    • @createbyte
      @createbyte  11 місяців тому +1

      All the best

    • @mirwado1384
      @mirwado1384 11 місяців тому

      ​@@createbytesir i have to do research on the topic (pre and post flood water quality analysis in sindh ) so plz sir can u guide me

  • @kayirangabilly7232
    @kayirangabilly7232 Місяць тому

    Thank you for sharing this code but I got an error about "RefinedLee is not defined" and couldn't able to figure out how you did define this function. Can you help me please or any guys who have solved this issue?

  • @myatmin6336
    @myatmin6336 4 місяці тому +1

    I have a issues which "toDB is not defined" . Please let me know what is this issue?

  • @Walker-nb9de
    @Walker-nb9de 2 місяці тому

    i think the barren lands are classified as water bodies..... Just a tweak. Good Work

  • @simbarashethondhlana8327
    @simbarashethondhlana8327 Рік тому +1

    Well presented. Thank you so much.

  • @geykum_shakeshigh
    @geykum_shakeshigh 6 місяців тому

    Can I ask a question here mate, am sure you'all have encountered an issue where you have to clip a DEM file for a small area it shows pixels, just pixels, can this be Improved like using GEE to have the exact scale for proper representation of the map?

  • @dhiazahira6846
    @dhiazahira6846 Рік тому

    Sir, what the name of methodh that you use, change detection or something else?

  • @dhiazahira6846
    @dhiazahira6846 Рік тому

    Hello sir, thanks for the video. I wanna ask you how to determine the min max value?

  • @geykum_shakeshigh
    @geykum_shakeshigh 7 місяців тому

    Thank you for the video and the code sir, I appreciate it

  • @JHN_Productions
    @JHN_Productions 5 місяців тому +1

    toDB function is not working in my code editor

  • @jovin.thazhal
    @jovin.thazhal 5 місяців тому

    mine showing zero size and boundary is not adding in the layer
    what can i do

  • @DorsaMohammadi-zq2nt
    @DorsaMohammadi-zq2nt 4 місяці тому +1

    how can access to all codes?

  • @facts_tv6343
    @facts_tv6343 Рік тому

    Which code can we use to output the final map result. please can you reply below. Thank you

    • @createbyte
      @createbyte  11 місяців тому

      map.layer and then include the layer you want add

  • @eeshacrafts6122
    @eeshacrafts6122 Рік тому

    Good say sir, please i stuck 😢.
    My good state size is printing as zero, what do i do?

    • @eeshacrafts6122
      @eeshacrafts6122 Рік тому

      Please I would appreciate getting a response as soon as possible

    • @createbyte
      @createbyte  Рік тому

      Is your issue fixed ?

  • @файзуллаевАсадбек
    @файзуллаевАсадбек 2 місяці тому +1

    code

  • @siyadabdirahmansiyad379
    @siyadabdirahmansiyad379 Рік тому

    thanks for your kind sharing bro, How can get other countries feature boundaries?

    • @createbyte
      @createbyte  Рік тому

      Yes . Just search for your country boundary shape files

  • @GISHacks
    @GISHacks 10 місяців тому

    Thank you so much. Would you please share the code?

  • @elsysielatchom
    @elsysielatchom Рік тому +2

    Good morning Sir thanks for this kind explanation. Please can you share script with us?

  • @kingkhan-qb5rj
    @kingkhan-qb5rj 11 місяців тому

    Is it possible to calculate total flood area of Pakistan?

  • @valosspu2024
    @valosspu2024 8 місяців тому

    i'm getting same value of in inspector of good and flood filter its all same as you

  • @jyotiprakashhati4058
    @jyotiprakashhati4058 Рік тому +1

    The code says toDB is not defined.

    • @createbyte
      @createbyte  Рік тому

      Check the comments section and description
      I have pinned the toDB function there
      You can simply copy paste that into your editor

  • @ZeeshanZafarzams706
    @ZeeshanZafarzams706 9 місяців тому

    But this code shows a lot of water bodies on the eastern side, which we all know is a huge desert. I think its mixing sand with water.

  • @SocialAnalyst33
    @SocialAnalyst33 Рік тому

    Asslamualikum Sir. Thanks for This video, Can you share the flood report ! i need it

    • @createbyte
      @createbyte  Рік тому

      pdma.gos.pk/flood-2022-in-sindh/
      Download the pdf from here brother

  • @razirajpoot200
    @razirajpoot200 7 місяців тому

    can i get coding?

  • @birhanukifle517
    @birhanukifle517 Рік тому

    It is Nice

  • @geologistdinesh
    @geologistdinesh Рік тому

    could you send me code of this anaysis

    • @createbyte
      @createbyte  Рік тому

      Even if I share you the code
      It wont run because you wont have the imported assets , which are non shareable at the moment by Earth engine

  • @usamakhatab8989
    @usamakhatab8989 10 місяців тому

    flood water should be more than simple water. but in this analysis simple water is more. why?

  • @dwikifebriyan-z9k
    @dwikifebriyan-z9k Рік тому

    bang bagi codingnya bang

  • @geologistdinesh
    @geologistdinesh Рік тому +1

    Non-satisfied your answer, we want to see ce script, otherwise no explanation is required

    • @createbyte
      @createbyte  Рік тому

      Will surely try to work on that in upcoming videos

  • @Rajesh-t3l6c
    @Rajesh-t3l6c 8 місяців тому

    T