GEE Tutorials

Google Earth Engine Tutorial: Download Stream Data from HydroSHED

Credit: Youtube Channel “Terra Spatial, Learn how to download stream network data using HydroSHED dataset for river analysis.”

You can see all the tutorials from here: Techgeo Academy.

Introduction

HydroSHEDS (Hydrological SHapefile and Elevation Derivatives for the Earth’s Drainage System) is a global dataset of drainage networks and terrain attributes derived from high-resolution elevation data. Google Earth Engine (GEE) provides access to this dataset, enabling users to analyze and export stream data efficiently. This tutorial guides you through accessing and downloading HydroSHEDS stream data using GEE.

Setup and Authentication

To begin, ensure you have a Google Earth Engine account and have activated the API. Install the GEE Python client library if not already done:

pip install earthengine-api

Authenticate your GEE session using:

earthengine authenticate

Accessing HydroSHEDS Dataset

The HydroSHEDS dataset is available in GEE under the ID WWF/HydroSHEDs/v1. You can load it into the GEE code editor with the following script:

var hydrosheds = ee.Image('WWF/HydroSHEDs/v1');

The dataset includes bands such as stream_order (1-8 corresponding to drainage order), flowdir (flow direction), and d8_flowdir (D8 algorithm). These can be explored further in the GEE documentation.

Filtering by Region

Use a geometry or region to limit the data scope. For example, create a rectangle for a specific area:

var region = ee.Geometry.Rectangle([x1, y1, x2, y2]);

Extract the relevant stream order band (e.g., stream_order 1-8):

var streamData = hydrosheds.select('stream_order');

Visualizing Stream Data

Use the GEE code editor to visualize the data. Add the image to the map with a custom palette:

Map.addLayer(streamData, {palette: ['blue', 'green', 'red'], max: 8}, 'Stream Order');

This will display drainage networks using different colors for varying stream orders.

Downloading the Data

Export the data as a GeoTIFF to your Google Drive account:

Export.image.toDrive({  
    image: streamData,  
    description: 'stream_order_export',  
    folder: 'GEE_Exports',  
    fileNamePrefix: 'stream_order',  
    region: region,  
    scale: 30,  
    crs: 'EPSG:4326',  
    fileFormat: 'GeoTIFF'  
  });

Monitor the download in the GEE Tasks panel. The GeoTIFF will be stored in your Drive under the specified folder.

FAQ

What if the dataset ID is incorrect?

Double-check the dataset ID in the GEE Data Catalog. HydroSHEDS datasets may require specific attribution or licensing agreements before access.

How do I handle different resolutions?

The HydroSHEDS dataset has 30m and 90m resolutions. Adjust the scale parameter in the export function to match your analysis needs.

Can I download multiple bands?

Yes. Modify the select function to include multiple bands, e.g., hydrosheds.select(['stream_order', 'flowdir']).

What file formats are supported?

GeoTIFF is the most common format. You can also use CSV or TFRecord by changing the fileFormat parameter.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *