Skip to content

Various blending functions for Google Earth Engine

Notifications You must be signed in to change notification settings

jessjaco/gee-blend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 

Repository files navigation

gee-blend

Jesse Anderson

About

gee-blend is a code module for using blended visualizations in Google Earth Engine. It can be loaded in the playground by clicking here, which will add the repository containing the code to the Reader section of the Scripts tab, under users/jja/public. The script blend_demo.js illustrates some of its basic functionality.

Using the Module

You can load the module in your code by running

var blend = require('users/jja/public:blend.js');

Blend functions can be applied using the following pattern: blend.<function>(top_image, bottom_image); Where <function> is one of the following:

  • addition
  • burn
  • darken
  • difference
  • dodge
  • hard_light
  • lighten
  • multiply
  • normal
  • overlay
  • screen
  • subtract

`

Here is an example blend operation and output.

Code:

// First, add the module to your account by going to https://code.earthengine.google.com/?accept_repo=users/jja/public

// Load the module
var blend = require('users/jja/public:blend.js');

// Load and visualize a digital elevation model
var dem = ee.Image("CGIAR/SRTM90_V4");
var dem_rgb = dem.visualize({
  min:100, 
  max:6000, 
  palette: ['#000004', '#50127b', '#b63679', '#fc8761', '#fdfd65'],
  forceRgbOutput:true
});

// Derive and visualize a slope image
var slope_rgb = ee.Terrain.slope(dem).visualize({
  min:0, 
  max:90, 
  palette: ['#000000', '#ffffff'],
  forceRgbOutput:true
});

// Use the `difference` blend function and add to the map
Map.addLayer(blend.difference(dem_rgb, slope_rgb), {min:-41, max:163});

// Zoom to an interesting location
Map.setCenter(71.2, 36, 9);

Image: blend_ex_1

Some other examples

NLCD over hillshade, in northern New Mexico (using blend.multiply): nlcd_hillshade

Elevation over slope, using blend.dodge (Grand Canyon): gc

License

The blend code is licensed under the terms of the MIT license.

About

Various blending functions for Google Earth Engine

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published