Tag: GCP

  • Google Earth Engine and Geospatial analysis

    Just started looking at Google Earth Engine (GEE). We are interested in using satellite images to explore potential use cases:

    • study the consequences of climate changes – carbon emissions showing measurable progress
    • Environmental monitoring – rapid flood and damage mapping using synthetic aperture radar (SAR) in response to flash flooding

    There are total of 1052 satellites in the orbit and have generated exabytes of data. The satellite data is growing fast.

    Google has built one of the largest and most sophisticated data infrastructures in the world. They handle over 2.5 exabytes (2,500,000,000 gigabytes) of data every single day. 4 Feb 2023

    From Google

    Steps

    • Get area of interest (AOI) – you may use geojosn.io
    • Acquire satellite data – Google datasets SAR, Sentinel, etc
    • Carry out image processing
    • Mapping
    • Visualisation or Geospatial analysis

    Example of working with Landsat data in GEE

    We will use Google CoLab with th following Python library:

    • earthengine-api
    • folium
    • geehydro
    # -*- coding: utf-8 -*-
    """intro_GEE.ipynb
    
    Automatically generated by Colaboratory.
    
    Original file is located at
        https://colab.research.google.com/drive/12zoOffu2QrS7ZlCm7zCmWtuwFpejBAZ0
    
    Companion Jupyter Notebook to the article [**A Quick Introduction to Google Earth Engine**](https://towardsdatascience.com/a-quick-introduction-to-google-earth-engine-c6a608c5febe) published in Towards Data Science.
    
    ## Setting your toolbox
    """
    
    !pip install earthengine-api
    !pip install folium
    !pip install geehydro
    
    import ee
    import folium
    import geehydro
    
    from datetime import datetime as dt
    from IPython.display import Image
    
    """## Initialize the connection to the server"""
    
    !earthengine authenticate
    
    ee.Initialize()
    
    """## Select a region in the world"""
    
    # the Ituna/Itatá Indigenous Land in Brazil.
    Ituna_map = folium.Map(location=[-4.06738, -52.034], zoom_start=10)
    # jagannathpur Ituna_map = folium.Map(location=[24.79422, 91.546130], zoom_start=10)
    Ituna_map
    
    """## Setting the Area of Interest (AOI)"""
    
    Ituna_AOI = ee.Geometry.Rectangle([-51.84448, -3.92180,
                                       -52.23999, -4.38201])
    
    # jagannathpur 24.79422, 91.546130
    #Ituna_AOI = ee.Geometry.Rectangle([24.79422, 91.546130,24.727354, 91.515635])
    
    Ituna_AOI
    
    """## The Landsat 8 Collection"""
    
    landsat = ee.ImageCollection("LANDSAT/LC08/C01/T1_SR")
    # choose dates
    landsat = landsat.filterDate('2019-07-01','2019-12-01')
    # filter area
    landsat_AOI = landsat.filterBounds(Ituna_AOI)
    
    """## A bit of meta-data"""
    
    landsat_AOI.getInfo()
    
    # total number of images.
    print('Total number:', landsat_AOI.size().getInfo())
    
    # the names of each Landsat 8 band
    landsat_AOI.first().bandNames().getInfo()
    
    """# Choosing an Image"""
    
    # the least cloudy image
    least_cloudy = ee.Image(landsat_AOI.sort('CLOUD_COVER').first())
    
    # how cloudy is it?
    print('Cloud Cover (%):', least_cloudy.get('CLOUD_COVER').getInfo())
    
    # when was this image taken?
    date = ee.Date(least_cloudy.get('system:time_start'))
    time = date.getInfo()['value']/1000.
    dt.utcfromtimestamp(time).strftime('%Y-%m-%d %H:%M:%S')
    
    """## Visualizing the Satellite imagery"""
    
    parameters = {'min': 0,
                  'max': 1000,
                  'dimensions': 512,
                  'bands': ['B4', 'B3', 'B2'],
                  'region': Ituna_AOI}
    
    Image(url = least_cloudy.getThumbUrl(parameters))
    
    """## Normalized Difference Vegetation Index (NDVI)"""
    
    ndvi = least_cloudy.normalizedDifference(['B5', 'B4'])
    
    palette = ['red', 'yellow', 'green']
    
    ndvi_parameters = {'min': 0,
                       'max': 1,
                       'dimensions': 512,
                       'palette': palette,
                       'region': Ituna_AOI}
    
    Ituna_map.addLayer(ndvi, ndvi_parameters)
    Ituna_map